Skip to content
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

Merged
merged 8 commits into from
Nov 7, 2017
Merged

Add Stylus loader #195

merged 8 commits into from
Nov 7, 2017

Conversation

mneuhaus
Copy link

No description provided.

Copy link
Collaborator

@Lyrkan Lyrkan left a 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:

* Or pass options to the loader
*
* Encore.enableStylusLoader(function(options) {
* // https://github.com/shama/stylus-loader
Copy link
Collaborator

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)?

Copy link
Author

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'}
    ]
})

Copy link
Collaborator

Choose a reason for hiding this comment

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

Hey @mneuhaus ,

I agree that not many options are available for that loader.
Maybe : options.import = ['~library/index.styl']; ?
There is an example here in which they do something like that in order to use nib.

Copy link
Author

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 :)

@@ -185,6 +186,13 @@ class ConfigGenerator {
});
}

if (this.webpackConfig.useStylusLoader) {
rules.push({
test: /\.stylus/,
Copy link
Collaborator

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:

Copy link
Author

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 :)

@mneuhaus
Copy link
Author

mneuhaus commented Nov 2, 2017

i'll try to take care of those tonight :) 👍

@mneuhaus
Copy link
Author

mneuhaus commented Nov 3, 2017

i added the tests and fixed the mentioned comments :)

Copy link
Collaborator

@Lyrkan Lyrkan left a 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 👍

Copy link
Member

@weaverryan weaverryan left a 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'],
Copy link
Member

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?

@mneuhaus
Copy link
Author

mneuhaus commented Nov 7, 2017

@weaverryan there you go :)

@weaverryan weaverryan merged commit fb93a8f into symfony:master Nov 7, 2017
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.

None yet

3 participants