-
-
Notifications
You must be signed in to change notification settings - Fork 198
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
Add Stylus loader #195
Add Stylus loader #195
Conversation
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.
Hi @mneuhaus,
That PR looks great, I have some comments though:
- Could you also update the
yarn.lock
file with the added dev dependency? - Could you add some tests in:
test/config-generator.js
(e.g. to check that the loader is added to the generated config)test/WebpackConfig.js
(e.g. to check that you can't callenableStylusLoader
with a non-callback parameter)test/functional.js
(e.g. to check that some stylus files give the expected css files)
* Or pass options to the loader | ||
* | ||
* Encore.enableStylusLoader(function(options) { | ||
* // https://github.com/shama/stylus-loader |
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.
Could you add another line with an example there so people know how to use options
(using a real one)?
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.
to be honest, there isn't much that can be configured, i can not think of a good example off the top of my head. (https://github.com/shama/stylus-loader/blob/master/index.js#L33)
The primary reason, for putting this in encore is, that adding a css preprosessor that properly works with encore is a bit much boilerplate:
.addLoader({
test: /\.styl/,
use: [
{ loader: './node_modules/extract-text-webpack-plugin/dist/loader.js',
options: { omit: 1, remove: true } },
{ loader: 'style-loader?sourceMap' },
{ loader: 'css-loader',
options: {
minimize: false, sourceMap: true, importLoaders: 0
}
},
{ loader: 'stylus-loader'}
]
})
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.
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.
sure, sounds fine, i added it :)
lib/config-generator.js
Outdated
@@ -185,6 +186,13 @@ class ConfigGenerator { | |||
}); | |||
} | |||
|
|||
if (this.webpackConfig.useStylusLoader) { | |||
rules.push({ | |||
test: /\.stylus/, |
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.
Is the .stylus
file extension the recommended one? I saw .styl
used on multiple pages:
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.
you're absolutely right, that is a typo, which i'll fix right away :)
i'll try to take care of those tonight :) 👍 |
b443cf8
to
b80bd05
Compare
i added the tests and fixed the mentioned comments :) |
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.
Looks good to me 👍
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.
Just one small comment. This looks awesome and I'm excited to merge it :)
lib/features.js
Outdated
@@ -26,6 +26,11 @@ const features = { | |||
packages: ['less-loader'], | |||
description: 'load LESS files' | |||
}, | |||
stylus: { | |||
method: 'enableStylusLoader()', | |||
packages: ['stylus-loader'], |
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.
I believe we also need stylus
, correct?
@weaverryan there you go :) |
No description provided.