How to simplify the @import path for my npm sass package? -
situation
i have developed small sass package , published on npm.
to use package in project npm install
, import main file so:
@import 'node_modules/my-package/my-package.scss';
this works.
question
is possible allow users import so?
@import 'my-package';
or
@import 'my-package.scss';
i think saw packages allow this. possible?
any kind of appreciated!
with gulp , gulp-sass, people can specify includepaths
.pipe(sass({ includepaths: [ './node_modules/your-package-name' ] }))
this tell compiler includes appending path import compiling.
then in *.scss files need do
@import "your-package-name";
or
@import "your-package-name/variables";
otherwise, don't think it's possible similar setup - after all, it's url, unless pre-processing, need specify full path it
Comments
Post a Comment