thgh / rollup-plugin-scss

Rollup and compile multiple .scss, .sass and .css imports
MIT License
135 stars 46 forks source link

Unable to include css files from installed packages #24

Closed emepyc closed 4 years ago

emepyc commented 5 years ago

I'm trying to combine some scss / css files into one bundle using this package. In my entry.js I import all the stylesheets with:

import "awesomplete/awesomplete.css";
import "./simple-modal-custom.css";
import "./custom.scss";

The first one if from an installed module (ie in node_modules/awesomplete/awesomplete.css. But this files get ignored and only the other 2 get bundled. If I use relative imports this seems to work:

import "../node_modules/awesomplete/awesomplete.css";

I would expect the first version to work. Am I missing something?

thgh commented 5 years ago

That should be equivalent to import "awesomplete/awesomplete.css";

emepyc commented 5 years ago

yes, it should be the same (I have updated the OP with the correct import), but import "awesomplete/awesomplete.css" is not bundling the awesomplete css file for me

thgh commented 5 years ago

Do you mind creating a test repository?

This plugin has no default excludes. (rollup-plugin-sass excludes node_modules/** by default)

frederikhors commented 5 years ago

Me too:

@import "bootstrap/scss/bootstrap.scss"; doesn't work,

@import "../node_modules/bootstrap/scss/bootstrap.scss"; works.

jonathanmarvens commented 5 years ago

Any updates on this? CC: @thgh

thgh commented 5 years ago

I don't know how node-sass resolves imports, if anyone could look into resolving node_modules, that would solve this?

aharris commented 5 years ago

You should be able to include node_modules:

    scss({
      includePaths: [
        'node_modules/'
      ]
    }),
thgh commented 4 years ago

@aharris Cool, I released version 2.0.0 with that includePath by default.