Example webpack 2 file and example stylus loader

I am stuck with getting a stylus to work with webpack 2. I am trying to add a stylus loader module to my webpack.config, but I have no hint on how to do this. I am not that I have not read the documentation:

https://github.com/shama/stylus-loader

At first glance, this code example looks like a piece of cake (keep in mind, I'm talking to Webpack 2 here, not Webpack 1):

module: { rules: [ { test: /\.styl$/, use: [ 'style-loader', 'css-loader', { loader: 'stylus-loader', options: { use: [stylus_plugin()], }, }, ], } ], }, 

The problem is the stylus_plugin function, which, according to the documentation, is required using:

 var stylus_plugin = require('stylus_plugin'); 

However, there is no npm module like stylus_plugin in an npm repo.

So, maybe someone can help me with running the stylus on a web package, and maybe someone can even provide a configuration example.

Addendum, February 9, 2017. This works for me (with a stylus):

 module: { rules: [{ test: /\.styl$/i, use: [ 'style-loader', 'css-loader', 'stylus-loader' ] }] } 

To explain: each individual bootloader is a separate plugin. Therefore, you must add each of these three plugins via / npm yarn.

+7
plugins stylus express webpack-2
source share
1 answer

So stupid! I have not seen that stylus_plugin was a common placeholder for stylus plugins. I have to get some coffee ...

+5
source share

All Articles