引用node_modules文件夹中的资源 [英] Referencing resources in node_modules folder

查看:779
本文介绍了引用node_modules文件夹中的资源的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在编写我的第一个Node.js应用程序。我最近通过npm安装了引导程序(遵循引导程序的网站上的说明),并且想知道标准引用bootstap.min.css(和其他感兴趣的文件)的方法。最好使用grunt / gulp将我需要的资源复制(捆绑和最小化)到我的项目结构中?

I am currently in the process of writing my first Node.js app. I recently installed bootstrap via the npm (following instructions on bootstrap's web site) and was wondering the "standard" way of referencing the bootstap.min.css (and other files of interest). It is best to use grunt/gulp to copy (bundle and minify) the resources I need into my project structure?

任何帮助将不胜感激。

推荐答案

我能够通过一个简单的Grunt任务使用node_modules引导程序资源进行复制:

I was able to copy with the node_modules bootstrap resources with a simple Grunt task:

copy: {
    bootstrapSrcCss: {
      src: "./node_modules/bootstrap/dist/css/bootstrap.css",
      dest: "./public/src/css/bootstrap.css"
    },
    bootstrapSrcJs: {
      src: "./node_modules/bootstrap/dist/js/bootstrap.js",
      dest: "./public/src/js/bootstrap.js"
    }
}

使用grunt插件:grunt-contrib-copy

Using grunt plug-in: grunt-contrib-copy

这篇关于引用node_modules文件夹中的资源的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆