How to use this plugin for bower_components of contains css?
janryWang opened this issue · 4 comments
How to use this plugin for bower_components of contain the css? Because most of bower_components are included css.
@janryWang What do you want to achieve? This plugin wires up the installed bower components in your requirejs config. This does not handle any CSS files of installed bower components. In case you just want to automatically wire up your css dependencies in your html files you should take a look at https://github.com/stephenplusplus/grunt-wiredep
It would be pretty cool if grunt-bower-requirejs could make use of require-css to automatically inject CSS files. I've used a setup like the following to declare CSS files as dependencies.
For example:
require(['jquery', 'bootstrap'], function($) {
$('#modal').modal('show');
});
Meanwhile, in the requirejs shim config, bootstrap has a dependency on its own CSS files. Something like this:
"bootstrap" : {
"deps": ["jquery", "css!lib/css/bootstrap.min"]
},
@bezoerb I'd be happy to put together a pull request for this feature if it's a) possible and b) desired. I know I would get a lot of use out of it. Being able to not give any cares about the file path of the CSS files in bower modules would be really nice.
@mwcz I could not see the benefit justifying the effort of developing this feature. Let's keep this issue open to get some feedback from the community about this. When you provide a good PR i'm sure this could be merged.
Cool, I'll try to make time to work on this if the community feedback is positive.
I haven't had a good look at the metadata included in bower components, so I don't know yet if the proper css file(s) to inject are listed explicitly.