shakacode / bootstrap-sass-loader

Webpack Loader for the Sass version Twitter Bootstrap
MIT License
118 stars 25 forks source link

Make loaders for stylesheet configurable to support the ExtractTextPlugin #1

Closed justin808 closed 9 years ago

justin808 commented 10 years ago

Gitter conversation 11/21/2014: @sokra I'm trying to make my example https://github.com/justin808/bootstrap-sass-loader-example work with the https://github.com/webpack/extract-text-webpack-plugin

This creates the css.

  entry: [
    'bootstrap-sass!./bootstrap-sass.config.js'  // using customization file
  ],

I've got the css loader specified:

    loaders: [
      { test: /\.css$/, loader: ExtractTextPlugin.extract("style-loader", "css-loader") },

but that's not what I need. Do I need to integrate the ExtratractTextPlugin into the bootstrap-sass-loader? Or is there a way to chain the the loaders?

@justin808: The problem is you hardcoded the loaders that should be used for the stylesheet (to style!css!sass). You need to give the user the choice which loaders should be used. Maybe you offer an API like this one:

var bootstrapSass = require("bootstrap-sass");
entry: [
  bootstrapSass({
    scripts: { /* ... */ },
    styles: { /* ... */ },
    mainStyle: "./path-to-xyz.sass",
    styleLoader: ExtractTextPlugin.extract("style-loader", "css-loader!sass-loader")
    // default to "style-loader!css-loader!sass-loader"
    // ...
  })
]

The bootstrap, style-loader, css-loader, and sass-loader should be peerDependencies.

justin808 commented 10 years ago

There's an open issue on the path for fonts when using the extract text plugin.

justin808 commented 9 years ago

Fixed: https://github.com/justin808/bootstrap-sass-loader/pull/2