-
-
Notifications
You must be signed in to change notification settings - Fork 199
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,14 +15,14 @@ const applyOptionsCallback = require('../utils/apply-options-callback'); | |
|
||
/** | ||
* @param {WebpackConfig} webpackConfig | ||
* @param {Object} sassOption Options to pass to the loader | ||
* @param {bool} useCssModules | ||
* @return {Array} of loaders to use for Sass files | ||
*/ | ||
module.exports = { | ||
getLoaders(webpackConfig, sassOptions = {}) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No point keeping a |
||
getLoaders(webpackConfig, useCssModules = false) { | ||
loaderFeatures.ensurePackagesExistAndAreCorrectVersion('sass'); | ||
|
||
const sassLoaders = [...cssLoader.getLoaders(webpackConfig)]; | ||
const sassLoaders = [...cssLoader.getLoaders(webpackConfig, useCssModules)]; | ||
if (true === webpackConfig.sassOptions.resolveUrlLoader) { | ||
// responsible for resolving Sass url() paths | ||
// without this, all url() paths must be relative to the | ||
|
@@ -35,7 +35,7 @@ module.exports = { | |
}); | ||
} | ||
|
||
const config = Object.assign({}, sassOptions, { | ||
const config = Object.assign({}, { | ||
// needed by the resolve-url-loader | ||
sourceMap: (true === webpackConfig.sassOptions.resolveUrlLoader) || webpackConfig.useSourceMaps | ||
}); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,19 +15,19 @@ const applyOptionsCallback = require('../utils/apply-options-callback'); | |
|
||
/** | ||
* @param {WebpackConfig} webpackConfig | ||
* @param {bool} ignorePostCssLoader If true, postcss-loader will never be added | ||
* @param {bool} useCssModules | ||
* @return {Array} of loaders to use for Stylus files | ||
*/ | ||
module.exports = { | ||
getLoaders(webpackConfig, ignorePostCssLoader = false) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
getLoaders(webpackConfig, useCssModules = false) { | ||
loaderFeatures.ensurePackagesExistAndAreCorrectVersion('stylus'); | ||
|
||
const config = { | ||
sourceMap: webpackConfig.useSourceMaps | ||
}; | ||
|
||
return [ | ||
...cssLoader.getLoaders(webpackConfig, ignorePostCssLoader), | ||
...cssLoader.getLoaders(webpackConfig, useCssModules), | ||
{ | ||
loader: 'stylus-loader', | ||
options: applyOptionsCallback(webpackConfig.stylusLoaderOptionsCallback, config) | ||
|
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
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 sincecssLoader.getLoaders()
looks into thewebpackConfig
object for that info.