简体   繁体   中英

Include css from node_module(npm package)?

I use React on client, and i need include css from npm package. Before I took them and copied to my local directorie with style.

I also use GULP in the working draft

You can use gulp to copy files from node_modules as part of your build:

var srcPath = "node_modules/whatever/stylesheets/*.css";
var buildPath = "folder/that/gets/served/to/client";
gulp.task("build-html", function () {
    return gulp.src(srcPath).pipe(gulp.dest(buildPath));
});

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM