标签: grunt-contrib-copy

在Grunt中复制dist文件的更有效方法?

gruntjs的新手,目前正在使用它将一些npm发行版移动到public/js文件夹.

这是代码:

module.exports = function(grunt) {

// Project configuration.
grunt.initConfig({
    pkg: grunt.file.readJSON('package.json'),

    copy: {
        bootstrapCss: {
            src: "./node_modules/bootstrap/dist/css/bootstrap.css",
            dest: "./public/css/bootstrap.css"
        },
        bootstrapTheme: {
            src: "./node_modules/bootstrap/dist/css/bootstrap-theme.css",
            dest: "./public/css/bootstrap-theme.css"
        },
        bootstrap: {
            src: "./node_modules/bootstrap/dist/js/bootstrap.js",
            dest: "./public/js/libs/bootstrap.js"
        },
        backbone: {
            src: "./node_modules/backbone/backbone.js",
            dest: "./public/js/libs/backbone.js"
        },
        backboneLocalstorage: {
            src: "./node_modules/backbone.localstorage/backbone.localStorage.js",
            dest: "./public/js/libs/backbone.localStorage.js"
        },
        requireJs: {
            src: "./node_modules/requirejs/require.js",
            dest: "./public/js/libs/requirejs.js"
        },
        underscore: {
            src: "./node_modules/underscore/underscore.js",
            dest: "./public/js/libs/underscore.js"
        },
        jquery: {
            src: "./node_modules/jquery/dist/jquery.js",
            dest: "./public/js/libs/jquery.js"
        },
        requireJsText: {
            src: "./node_modules/requirejs-text/text.js",
            dest: "./public/js/libs/requirejs-text.js"
        }
    }



});

// …
Run Code Online (Sandbox Code Playgroud)

javascript gruntjs grunt-contrib-copy

3
推荐指数
1
解决办法
1265
查看次数

Grunt复制任务无法保留目录结构

Bower用来安装我的项目的依赖项,只获取我需要的文件Grunt.js,并将它们复制到static应用程序服务.

其中一个是MathJax库,但是当我尝试复制整个文件夹(参见下面的代码)时,它只是忽略了目录并将所有文件喷射到目标而不处理MathJax目录结构.

copy: {
    MathJax: {
        expand: true,
        flatten: true,
        cwd: 'bower_components/MathJax/',
        src: ['**'],
        dest: 'base/static/MathJax/'
    }
}
Run Code Online (Sandbox Code Playgroud)

它是关于copy任务的常见错误Grunt还是我做错了什么?

gruntjs bower grunt-contrib-copy

2
推荐指数
1
解决办法
2581
查看次数

无法使用副本写入文件

我收到这个错误:

Warning: Unable to write file (Error code: EISDIR)
Run Code Online (Sandbox Code Playgroud)

我正在尝试复制目录中的所有文件和子文件夹.

当我省略**但以后没有复制我的文件时,以下工作.

任何想法如何解决错误?

copy: {
        main: {
            options: {
                expand: true
            },
            files: [
                { src: 'public/static/**', dest: '../../../public/packages/xyz/hello'}

            ]
        }
    },
Run Code Online (Sandbox Code Playgroud)

gruntjs grunt-contrib-copy

2
推荐指数
1
解决办法
968
查看次数

使用Grunt.js将所有HTML文件从一个目录结构复制到另一个目录结构

我有一个大型目录结构,大多数应用程序的典型.

例如,像这样:

theprojectroot
|- src
|     |- app
|     |     |- index.html
|     |     |- index.js
|     |     |- userhome
|     |     |     |- userhome.html
|     |     |     |- userhome.js
|     |     |- management
|     |     |     |- management.html
|     |     |     |- management.js
|     |     |- social
|     |     |     |- social.html
|     |     |     |- social.js
|     |- assets
|- vendor
|- package.json
Run Code Online (Sandbox Code Playgroud)

我想将所有HTML目录中的所有文件 - 只有 HTML文件 - 复制到另一个文件夹中.

我目前正在使用Grunt copy复制所有文件,但现在我只想为HTML做这件事.在文档中,似乎没有选择文件类型的任何选项.

有没有人有他们可以建议这样做的黑客?

build gruntjs grunt-contrib-copy

2
推荐指数
1
解决办法
2474
查看次数

Grunt:在构建时更改文件扩展名

我想编写一个Grunt任务,在构建期间,将复制我拥有的所有.html文件,并在/ dist中创建它的.asp版本.

我一直在尝试使用grunt-contrib-copy来实现这一点,这就是我所拥有的:

copy: {
  //some other tasks that work...

  //copy an .asp version of all .html files
  asp: {
    files: [{
      expand: true,
      dot: true,
      cwd: '<%= config.app %>',
      src: ['{,*/}*.html'],
      dest: '<%= config.dist %>',
      option: {
        process: function (content, srcpath) {
          return srcpath.replace(".asp");
        }
      }
    }]
  } //end asp task
},
Run Code Online (Sandbox Code Playgroud)

我知道这个process功能实际上并不正确......我已经尝试了一些不同的正则表达式,使其工作无济于事.当我运行asp任务时,Grunt CLI说我已经复制了2个文件,但它们无处可寻.任何帮助表示赞赏.

gruntjs grunt-contrib-copy

1
推荐指数
1
解决办法
1375
查看次数

不允许使用EPERM操作的grunt-contrib-copy模块"C:\ Documents and Settings"

我正在尝试grunt使用一个简单的任务grunt-contrib-copy,但它在到达复制任务时立即死亡,并显示以下消息:

运行"copy:main"(复制)任务

警告:EPERM,不允许操作'C:\ Documents and Settings'使用--force继续

因警告而中止

我在跑步:

  • Windows 7 64位(所以C:\Documents and Settings不存在)
  • 节点0.10.28(安装在C:\nodejs)
  • npm 1.4.9
  • grunt-cli 0.1.13
  • 咕噜0.4.5
  • grunt-contrib-copy 0.5.0

我在两个C:\nodejs和我的项目文件夹(C:\Users\myusername\Documents\Programming\myprojectname没有空格或括号)中对"文档和设置"进行了全文搜索,但没有匹配.

我的copy任务定义是:

copy: {
    main: {
        files: [
            {expand: true, cwd: 'src/core', src: '/**', dest: 'src/chrome/'},
            {expand: true, cwd: 'src/core', src: '/**', dest: 'src/firefox/'}
        ]
    }
},
Run Code Online (Sandbox Code Playgroud)

可能导致此错误的原因是什么?

node.js gruntjs grunt-contrib-copy

0
推荐指数
1
解决办法
3464
查看次数

标签 统计

grunt-contrib-copy ×6

gruntjs ×6

bower ×1

build ×1

javascript ×1

node.js ×1