ryanmortier's avatar

Importing from node_modules is different with Sass, Less, and Stylus?

When using Laravel Mix, to import from node_modules using either sass, less or stylus, it's always different. How do I know what to use? The following works, but I'm not sure if the stylus import has a more succinct way to import from node_modules rather than chaning a bunch of ../

app.scss

@import "node_modules/bootstrap-sass/assets/stylesheets/bootstrap";

app.less

@import "bootstrap/bootstrap.less";

app.styl

@import "../../../node_modules/vuetify/src/stylus/main.styl";
0 likes
1 reply
ryanmortier's avatar
ryanmortier
OP
Best Answer
Level 10

Actually, I just now learnt about Webpack's advanced resolver which works with sass, less, and stylus.

This syntax works for sass, less, and stylus (notice the ~ which tells it to look in node_modules)

@import "~vuetify/src/stylus/main";

Please or to participate in this conversation.