Using Browserify with CSS files

I’ve recently switched from Codekit to using gulp and browserify in the command line. It works great until you need to use something that has non-JS files with it (e.g. CSS files).

For example, this works fine:

var $ = require('jquery');

But if I want to add require('magnific-popup') (a jQuery plugin that has a JS file and CSS file) it only includes the JavaScript.

I can get it to work by installing the jQuery plugin using bower or npm and then linking to the JS and the CSS in the dist folder. This is fine, I just wondered, is there a better way of doing it? Is browserify mainly for pure JS modules?

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.