[1.3] Current solution for NPM modules with css files

It seems the new 1.3 NPM integration fails to include CSS files for the modules you install.

I have looked at 1.3 how to import css from npm package? and https://github.com/meteor/meteor/issues/6037 and a few more threads with more specific issues. There are a multitude of workarounds and suggested solutions in those threads, but I couldn’t find anything in the guide.

Is there not an officially recommended way to import NPM modules that contain CSS files?

it works well now (from Meteor 1.3.2).
See the example repos:

Yes it is working for scss as in those examples but I am using some modules, for example flickity, with plain css, which does not get included.

You can import .css files in .js files. So in the same .js file where you use Flickity just import the .css file like:

import 'flickity/path/to/css/file.css';

Meteor Guide: http://guide.meteor.com/build-tool.html#css-importing

1 Like

Oops, missed that, shame on me. Guess I got lost reading all the other posts…
That import works fine.

There’s an open issue about importing css inside css with @import, However there’s no official answer yet about this feature being supported in the future. For now importing from js is the only available option.

1 Like