-
Notifications
You must be signed in to change notification settings - Fork 916
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove underscore and integer from CSS Module localIdentName with single file components. #818
Comments
Is there any indication whether this is an issue with Vue.js, Vue loader, or something external such as Webpack, CSS modules, PostCSS? That would be incredibly helpful... |
This is appended by vue-loader intentionally: https://github.com/vuejs/vue-loader/blob/master/lib/loader.js#L154-L157
So with that reasoning explained, why would you want those indexes gone? As a sidenote, can you explain to me your choice for localIdentName? I'm no CSS modules expert, but it seems to me your chosen naming convention would make it even more likely to create duplicate classnames across your app than the scenario that vue-router tries to prevent with the appended |
@LinusBorg Thanks Linus! I am something of an odd situation where I am writing a proprietary functional component library that needs to accommodate both a Vue implementation and exporting to a legacy system with accessible HTML and CSS class names. Using localIdentName appears to be the best way to build the modular infrastructure of the future without necessarily relying on it for absolute guaranteed uniqueness at this point in time. Certainly open to suggestions if you have any! |
I strongly suggest removing the <style module="a">
</style>
<style module="b">
</style>
<!--
class = "[base64]_a"
class = "[base64]_b"
-->
Giving an error or warning like that when there is more than one <style> tags without value specified module in the same .vue file would be better. After all, single moduled <style> tag in a .vue file is the most often case. |
I guess #1104 will help you. |
What problem does this feature solve?
I'm loving CSS Modules with Vue.js but am having an issue dealing with a static export for server side rendering. I've been using the following for my localIdentName in webpack config:
cssModules: { localIdentName: '[name]-[local]' },
However, all of my classnames are generating with an _0 at the end which appears to be the direct result of using CSS modules in single file components. If the style tag uses an external source then the integer will go away, and if there are multiple styles the integer will be incremented accordingly.
Ideally, there would be a workaround where I could use single file components with inline modules without having the _integer generated by default.
What does the proposed API look like?
Unclear. Presumably this would be a minor setting or customization in the webpack configuration for vue loader.
The text was updated successfully, but these errors were encountered: