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

Stylus bootstrap loaded but not compiled #116

Closed
oric01 opened this issue May 12, 2016 · 1 comment · Fixed by #240
Closed

Stylus bootstrap loaded but not compiled #116

oric01 opened this issue May 12, 2016 · 1 comment · Fixed by #240

Comments

@oric01
Copy link

oric01 commented May 12, 2016

Hi,
I come here after having published a bug request on bootstrap-stylus : Stylus bootstrap loaded but not compiled with Webpack.
I've got some support from a bootstrap-stylus contributor then checked some issue on stylus-loader ( #12, #102) and tried some hint but with no result.

To resume : On Chrome inspector, I can see that bootstrap files are loaded but they are not parsed.

//Copied from my bootstrap-stylus issue

    "bootstrap-styl": "^5.0.5",
    "stylus": "^0.54.5",
    "stylus-loader": "^2.0.0",
    "webpack": "^1.9.5",

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 :

//webpack.config.js
module.exports = {
    ...
    module : {
        loaders: [
           { test: /\.styl$/, loader: 'style-loader!css-loader!stylus-loader' },
           { test: /\.css$/, loader: 'style!css' },
        ]
    }
    stylus: {
        use: [bootstrap()],
    },
}
//navbar.styl
@import 'bootstrap/buttons'

.navbar
    height 6.5rem
//navbar.html
<div class="navbar">
    <span class="btn btn-primary"></span>
</div>

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 ?

@kenaniah
Copy link
Contributor

It's a bit of a hack, but try adding this to your navbar.styl file:

@import "~bootstrap/dist/css/bootstrap.min.css"

I'm not sure what the path for the bootstrap buttons CSS file is, but you can find it by inspecting the relevant node module in node_modules assuming that's how you've installed it.

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 a pull request may close this issue.

2 participants