defunctzombie / npm-css

Require css from npm
MIT License
128 stars 8 forks source link

Cannot find module when using "on the fly" approach #22

Open nadav96 opened 7 years ago

nadav96 commented 7 years ago

Hi, I'm using gulp to automate the conversion of the file, but it produces an error, while the the bash command works as expected.

the gulp script:

    var npmcss = require('npm-css');
    require("fs").writeFile("app/dest/bundle.css", npmcss('app/first.css'));

the css file (first.css): @import "./random_css_file.css"; @import "bootstrap";

Produces an error: Cannot find module 'bootstrap'

While using the bash command did work as expected (required the css module to the bundle.css). I also tried without the local css file (random_css_file.css), same results...