-
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
index.styl suppose under root? #121
Comments
I think so too. I think the best option would be to remove "bootstrap" from the path, for both the Don't you think? |
Probably the #126 (comment) will help? |
For Webpack 2 users, this is a deal-breaker for using Bootstrap-stylus. Webpack 2 config (webpack 2.1.0-beta.21)
So you can see that the loader is finding If I edit my local copy of index.styl to:
... then this is the output:
... which means that the relative path is being resolved. From looking at the issues here, it seems like few of the maintainers are actually using Bootstrap-stylus with stylus-loader. The main reason I'm using Stylus is because of Bootstrap. My workaround for now is to locally duplicate index.styl and mixins.styl, change the paths to '~bootstrap-styl/bootstrap/...', and everything works as expected. If you are interested in a PR, let me know. I expect this would involve creating index-webpack.styl and mixins-webpack.styl files with the correct relative paths. |
You can use Bootstrap Stylus with webpack 2 (tested with package.json dependencies {
"bootstrap-styl": "^5.0.8",
"css-loader": "^0.25.0",
"extract-text-webpack-plugin": "^2.0.0-beta.4",
"file-loader": "^0.9.0",
"style-loader": "^0.13.1",
"stylus": "^0.54.5",
"stylus-loader": "^2.3.1",
"webpack": "^2.1.0-beta.25"
} In your JS file: import './my-styles.styl';
// ... your code here my-styles.styl @import 'bootstrap';
// ... your styles here webpack.config.js const webpack = require('webpack');
const ExtractTextPlugin = require('extract-text-webpack-plugin');
module.exports = {
entry: [
'./index.js',
],
module: {
rules: [
{
test: /\.(?:eot|otf|svg|ttf|woff2?)$/,
loader: 'file?name=[name].[ext]',
},
{
test: /\.styl$/,
loader: ExtractTextPlugin.extract({
fallbackLoader: 'style',
// `resolve url` is required to import the glyphicon font files
loader: 'css!stylus?paths=node_modules/bootstrap-styl&resolve url',
}),
// To inject the CSS into the header, comment out the loader above and `plugins`
// below and uncomment this loader:
// loader: 'style!css!stylus?paths=node_modules/bootstrap-styl&resolve url',
},
],
},
output: {
filename: 'output.js',
},
plugins: [
new ExtractTextPlugin('[name].css'),
],
}; And in your HTML <script src="output.js"></script>
<link href="main.css" rel="stylesheet" /> |
Thanks @kane-c ! I'm not quite ready to upgrade to the latest Webpack beta (I'm using beta.21) at the moment due to the changes around loader option config. But your example gives me hope 👍 If my |
Glad it helped! It shouldn't be too hard to adapt the webpack config above for the older style. Off the top of my head - |
I don't know what's wrong with my config. I'm trying to create/add the css file inside my html but I'm getting a error in my console when run build-dev. Any help? Thank you. webpack.config.js
main.styl
package.json
|
Any help? @kane-c |
What is the error in your console? |
|
This error relates to the schema validation - likely comes from the webpack options for |
Ok, thank you. I'm using Webpack 3, maybe it's the problem. |
I had a similar error recently, you might have better luck adding some extra logging around |
Indeed :/ |
do u think index.styl need be outside bootstrap ?
so i can do like
@import '../../../libs/bootstrap-stylus'
in my stylus file .
or how can i import it to my stylus file ?
The text was updated successfully, but these errors were encountered: