-
Notifications
You must be signed in to change notification settings - Fork 113
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
Stylus bootstrap loaded but not compiled with Webpack #122
Comments
I haven't tried it with Webpack yet but try adding the Bootstrap directory to your Stylus path instead of using it as a plugin: module.exports = {
...
module : {
loaders: [
{ test: /\.styl$/, loader: 'style-loader!css-loader!stylus-loader' },
{ test: /\.css$/, loader: 'style!css' },
]
}
stylus: {
paths: ['node_modules/bootstrap-styl'],
},
} Then you can just import in your Stylus files as normal: |
Look like it doesnt care about
Until now only the I'm still in a heavy lurning step on Webpack, so I feel that it's about telling the loader to get Bootstrap files into the render step, but I dont know how... |
Looking at the docs for stylus-loader, this should do it: { test: /\.styl$/, loader: 'css-loader!stylus-loader?paths=node_modules/bootstrap-styl' } |
Yes I tried this, but it has the same effect than the |
No worries. Good luck! |
same problem, ERROR in ./ |
@kane-c Did your source map generate correctly? |
any luck on this? |
any luck on this +1? |
We'll accept a PR if someone wants to take this on and it requires a fix in the bootstrap-stylus repo. The new company I work for is using another framework so I haven't been able to test this against modern build tools. |
I managed to make it work with a small workaround: https://github.com/daniloprates/thin-starter main.styl $icon-font-path = "~bootstrap-styl/fonts/"
@import 'bootstrap'; webpack.config.js var bootstrap = require('bootstrap-styl');
module.exports = {
entry: {
a: './src/scripts/main.js',
b: './src/style/main.styl'
},
(...)
stylus: { use: [bootstrap()] },
(...)
}; loaders {
test: /\.(eot|svg|ttf|woff|woff2)$/,
loader: 'file?name=node_modules/bootstrap-styl/fonts/[name].[ext]'
} |
I put together my webpack sample and configured it for source maps. They nearly worked, but I ran into this bug with stylus-loader where the browser knows the Stylus file and line but trying to view it just shows a file with Has anyone been able to get source maps working properly? |
@kane-c adding the query parameter as you suggested worked for me, hope to anyone works to, here's my webpack.config.js module: {
// rules for modules (configure loaders, parser options, etc.)
rules: [
{
test: /\.html$/,
exclude: [/node_modules/],
use: [
{
loader: 'html-loader',
options: {
minimize: true
}
}
]
},
{
test: /\.js?$/,
exclude: [/node_modules/],
use: ['ng-annotate-loader', 'babel-loader']
},
{
test: /\.css$/,
exclude: [/node_modules/],
use: ['style-loader', 'css-loader']
},
{
test: /\.styl$/,
exclude: [/node_modules/],
use: [
'style-loader',
'css-loader',
'stylus-loader?paths=node_modules/bootstrap-styl'
]
},
{
test: /\.(svg|woff|woff2|ttf|eot|ico)$/,
exclude: [/node_modules/],
use: [
{
loader: 'file-loader?name=src/assets/css/fonts/[name].[hash].[ext]'
}
]
},
{
test: /\.(png|jpe?g|gif)$/,
exclude: [/node_modules/],
use: [
{
loader: 'file-loader?name=src/assets/img/[name].[ext]'
}
]
}
]
} |
I have submitted a PR for this, tested and working on my webpack configuration. |
Can you share the solution @lightbringer1991 ? |
Is there a solution that works with Webpack 4? |
Hi,
Im trying to use bootstrap-stylus in a Webpack context.
As far as I understand, bootstrap-stylus is a Stylus plugin so i used this config in order to parse bootstrap stylus files :
When I run my serve and inspect, I see that
btn
is loaded but not compiled (and off course btn-primary is not generated)I didnt found any other way to configure it with Webpack.
Any idea ?
The text was updated successfully, but these errors were encountered: