fbrctr / fabricator

A tool for building website UI toolkits and style guides
http://fbrctr.github.io/
MIT License
1.11k stars 124 forks source link

CSS libraries as Bower dependency #305

Closed davegomez closed 6 years ago

davegomez commented 7 years ago

I'm trying to use a only CSS library as dependency for my Styleguide using Bower, but can't completely understand how the management dependency works with Bower.

I'm gonna try to specify which my issues are:

_1. Tell webpack to search "bowercomponents"

The documentation says I have to add the module directory to the resolve key in the Webpack config:

// add the "resolve" property to the config
var config = {
  /* other config properties */
  resolve: {
    modulesDirectories: ['node_modules', 'bower_components']
  }
};

But looking at the Webpack's configuration file I find there's not a config variable, instead the config is exported with module.exports and this object has a resolve key in it. It is ok to just add modulesDirectories: ['bower_components'], to the resolve object?

2. Require the module

As I said before, I'm not installing a JS dependency but a plain CSS file, I wonder how can I import that CSS file and where (file) and how is the right way to do it?

The last question I have is about if this dependency I'm including is gonna be bundle and minify with the rest of my CSS? Because at the end that's the idea behind the use of Bower to manage this dependency.

LukeAskew commented 7 years ago

Try adding the resolve definition to the object exported by webpack.config.js

https://github.com/fbrctr/fabricator/blob/d536d2e5868a478271176eaddc782fa8d3fb58b2/webpack.config.js#L59