Skip to content

Add CSS modules support in Vue.js for Sass/Less/Stylus #511

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

Merged
merged 1 commit into from
Mar 1, 2019

Conversation

Lyrkan
Copy link
Collaborator

@Lyrkan Lyrkan commented Feb 5, 2019

As noted in #508 (comment), that previous PR actually only added support for standard CSS modules, but didn't work for other languages.

This new PR makes it so it also works with the Scss, Less and Stylus syntaxes (using the same principle).

Ping @Chesskingt :)

* @return {Array} of loaders to use for Less files
*/
module.exports = {
getLoaders(webpackConfig, ignorePostCssLoader = false) {
Copy link
Collaborator Author

@Lyrkan Lyrkan Feb 5, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ignorePostCssLoader wasn't actually useful since cssLoader.getLoaders() looks into the webpackConfig object for that info.

* @return {Array} of loaders to use for Sass files
*/
module.exports = {
getLoaders(webpackConfig, sassOptions = {}) {
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No point keeping a sassOptions parameter here, the only allowed option is resolveUrlLoader which is already handled here by directly looking into the webpackConfig object.

* @return {Array} of loaders to use for Stylus files
*/
module.exports = {
getLoaders(webpackConfig, ignorePostCssLoader = false) {
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ignorePostCssLoader wasn't needed here since cssLoader.getLoaders() look into the webpackConfig object for that info.

@tmalley99
Copy link

tmalley99 commented Feb 5, 2019 via email

@Lyrkan
Copy link
Collaborator Author

Lyrkan commented Feb 5, 2019

@Chesskingt Yes, that's the default name if you don't specify one in module.
I used custom names in my fixtures in order to have multiple modules in a single .vue file.

Feel free to test it: yarn add --dev git://github.com/Lyrkan/webpack-encore.git#scss-less-modules

@tmalley99
Copy link

tmalley99 commented Feb 5, 2019 via email

@tmalley99
Copy link

Is this being merged into main master today?

@tmalley99
Copy link

@Lyrkan ? :)

@Lyrkan
Copy link
Collaborator Author

Lyrkan commented Feb 6, 2019

@Chesskingt I usually don't merge my own PRs without any review (unless that's something really trivial or a security issue). And even if I did I can't publish a new version on npm anyway, so you'll have to a wait for @weaverryan to come by ^^

@tmalley99
Copy link

tmalley99 commented Feb 6, 2019 via email

@tmalley99
Copy link

@weaverryan this in next release?

@weaverryan
Copy link
Member

Excellent work - thanks @Lyrkan!

@weaverryan weaverryan merged commit 3224e6c into symfony:master Mar 1, 2019
weaverryan added a commit that referenced this pull request Mar 1, 2019
…Lyrkan)

This PR was merged into the master branch.

Discussion
----------

Add CSS modules support in Vue.js for Sass/Less/Stylus

As noted in #508 (comment), that previous PR actually only added support for standard CSS modules, but didn't work for other languages.

This new PR makes it so it also works with the Scss, Less and Stylus syntaxes (using the same principle).

Ping @Chesskingt :)

Commits
-------

3224e6c Add CSS modules support in Vue.js for Sass/Less/Stylus
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants