【问题标题】:Include css from node_module(npm package)?包括来自 node_module(npm 包)的 css?
【发布时间】:2016-04-13 07:05:07
【问题描述】:

我在客户端使用 React,我需要从 npm 包中包含 css。 在我把它们复制到我的本地目录之前。

我也在工作草案中使用 GULP

【问题讨论】:

    标签: node.js reactjs npm gulp node-modules


    【解决方案1】:

    作为构建的一部分,您可以使用 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));
    });
    

    【讨论】:

      猜你喜欢
      • 2022-08-19
      • 2017-03-20
      • 2017-06-13
      • 1970-01-01
      • 2017-11-12
      • 1970-01-01
      • 2011-11-03
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多