包含来自node_module的css (npm包)?

时间:2021-11-10 19:40:18

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.

我在客户端使用了React,我需要从npm包中包含css。然后我带着它们去了我当地的导演。

I also use GULP in the working draft

我也在工作草案中使用大口喝

1 个解决方案

#1


4  

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

您可以使用gulp从node_modules拷贝文件,作为构建的一部分:

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));
});

#1


4  

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

您可以使用gulp从node_modules拷贝文件,作为构建的一部分:

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));
});