Aurelia-cli and modules that require css in their js


#1

Hi,

I’m trying to use the npm package parallax.js in my app. This module is requiring css directly from its source code :
require("./styles.css");

I can’t manage to bundle it in my vendor bundle. Here is what I did in my aurelia.json :
{
"name": "parallax.js",
"path": "../node_modules/parallax.js",
"main": "main.js",
"resources": [
"styles.css"
]
},

But I still get an error at building time like these :
Location: /dev/path/test/node_modules/parallax.js/styles.css.js Requested by: \dev\path\test\node_modules\parallax.js\main.js Is this a package? Make sure that it is configured in aurelia.json and that it is not a Node.js package

I found this issue : https://github.com/aurelia/cli/issues/273 but can’t really do anything on the module sources, and really don’t want to fork it for that.
There must be a way to handle that with au-cli isn’t it?


#2

Hi,

Do you have the npm link for the parallax.js package? I cannot find it, and the one I found parallax-js doesn’t not have style.css in it’s module.

Also, what loader do you use? RequireJS, SystemJS?

Ben C.


#3

Hi @benydc

the package npm link is : https://www.npmjs.com/package/parallax.js

I use require.js module loader.

But I think I’ve used a strange project, I probably meant to use this much more popular one:
https://www.npmjs.com/package/parallax-js
and maybe there is no problem with this one, I will try with this one asap.

Still, it can be nice to know how to deal with package that require(’*.css’) in their sources.