grunt-contrib-copy

Grunt Copy Flatten not working as expected

馋奶兔 提交于 2019-12-21 07:36:27
问题 I have a directory structure as follows: source/ libraries/ d3.js lodash.js //etc I have grunt-copy setup as follows: copy: { main: { files: [ { src: ["source/libraries/*.js"], dest: "build/", flatten: true } I expect it to flatten the output into build, so that I will have build/ d3.js //etc Instead, I get a reproduction of the original directory structure in build: build/ source/ libraries/ d3.js //etc What gives? Am I not using flatten properly? 回答1: Well, if you're only using flatten

Using Regex in grunt-contrib-copy's “process” option not working

与世无争的帅哥 提交于 2019-12-13 05:46:15
问题 I'm trying to remove my live reload script from my index.html file dynamically using Grunt's copy plugin. The part of my Gruntfile with the code in question is here: copy: { main: { files: [ { expand: true, src: 'index.html', dest: 'build/', options: { process: function (content, srcpath){ return content.replace(/<script src = "http:\/\/localhost:9090\/livereload.js"><\/script>/g, " "); } } }, I checked a regex tester and it showed that the regular expression I have above should match the

How to use dynamic values in Grunt tasks called from inside a forEach?

丶灬走出姿态 提交于 2019-12-11 19:33:47
问题 We are trying to run grunt tasks using grunt.config.set for dynamically concatinated strings. These grunt.configs are set in a forEach loop and change each time before the task is run. This does unfortunately not work, as grunt only uses the last grunt.config.set and runs it multiple times with that very same value. See this example with a simple "copy" task ("copy" is just an example, we want to use this kind of dynamic options in other tasks, too): copy: { projectFiles : { files : [{ src:

When I run Grunt, I receive the following message: Local npm module “grunt-contrib-copy” not found. Is it installed?

家住魔仙堡 提交于 2019-12-07 02:59:25
问题 I have been trying to install Grunt. When I run grunt I receive the following list of messages and warnings: Local Npm module "grunt-contrib-copy" not found. Is it installed? Local Npm module "grunt-contrib-uglify" not found. Is it installed? Local Npm module "grunt-contrib-jshint" not found. Is it installed? Local Npm module "grunt-contrib-less" not found. Is it installed? Local Npm module "grunt-contrib-clean" not found. Is it installed? Local Npm module "grunt-contrib-watch" not found. Is

How to copy files without the full path with grunt.js?

Deadly 提交于 2019-12-05 09:16:42
问题 I want to copy the content of /pckg to /dist with grunt.js. Here is the structure: |-- folder1 | | | |-- folder2 | | | |-- pckg | | | |--myfolder | | | | | |-- myfiles | | | |--myfiles | | |-- dist | |--myfolder | | | |-- myfiles | |--myfiles Here's my Gruntfile.js module.exports = function (grunt) { // Package configuration grunt.initConfig({ // Metadata pkg: grunt.file.readJSON('package.json'), //Copy files copy: { main: { expand: true, src: 'folder1/folder2/pckg/**', dest: 'dest/' } } });

When I run Grunt, I receive the following message: Local npm module “grunt-contrib-copy” not found. Is it installed?

依然范特西╮ 提交于 2019-12-05 07:55:30
I have been trying to install Grunt. When I run grunt I receive the following list of messages and warnings: Local Npm module "grunt-contrib-copy" not found. Is it installed? Local Npm module "grunt-contrib-uglify" not found. Is it installed? Local Npm module "grunt-contrib-jshint" not found. Is it installed? Local Npm module "grunt-contrib-less" not found. Is it installed? Local Npm module "grunt-contrib-clean" not found. Is it installed? Local Npm module "grunt-contrib-watch" not found. Is it installed? Local Npm module "grunt-contrib-concurrent" not found. Is it installed? Local Npm module

Grunt Copy Flatten not working as expected

余生颓废 提交于 2019-12-04 01:35:15
I have a directory structure as follows: source/ libraries/ d3.js lodash.js //etc I have grunt-copy setup as follows: copy: { main: { files: [ { src: ["source/libraries/*.js"], dest: "build/", flatten: true } I expect it to flatten the output into build, so that I will have build/ d3.js //etc Instead, I get a reproduction of the original directory structure in build: build/ source/ libraries/ d3.js //etc What gives? Am I not using flatten properly? Well, if you're only using flatten because you want everything in source/libraries to go into build , I would suggest actually using the cwd

How to copy files without the full path with grunt.js?

穿精又带淫゛_ 提交于 2019-12-03 22:16:31
I want to copy the content of /pckg to /dist with grunt.js. Here is the structure: |-- folder1 | | | |-- folder2 | | | |-- pckg | | | |--myfolder | | | | | |-- myfiles | | | |--myfiles | | |-- dist | |--myfolder | | | |-- myfiles | |--myfiles Here's my Gruntfile.js module.exports = function (grunt) { // Package configuration grunt.initConfig({ // Metadata pkg: grunt.file.readJSON('package.json'), //Copy files copy: { main: { expand: true, src: 'folder1/folder2/pckg/**', dest: 'dest/' } } }); // Load the plugin that provides the "copy" task. grunt.loadNpmTasks('grunt-contrib-copy'); // Default

How to get Grunt-Contrib-Copy to copy files/directories relative to given source path

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-03 15:28:24
问题 First time using this task and what I'm trying to achieve is the following: copy all directories/files from src/js/bower_components/* to build/assets/js/vendor/ I've tried using cwd property but it doesn't work at all when I use it.. I've set it to: src/js/bower_components/ From src . ├── Gruntfile └── src └── js └── bower_components └── jquery I currently get: . ├── Gruntfile └── build └── assets └── js └── vendor src └── js └── bower_components └── jquery What I'd like . ├── Gruntfile └──

How to get Grunt-Contrib-Copy to copy files/directories relative to given source path

你说的曾经没有我的故事 提交于 2019-12-03 05:05:59
First time using this task and what I'm trying to achieve is the following: copy all directories/files from src/js/bower_components/* to build/assets/js/vendor/ I've tried using cwd property but it doesn't work at all when I use it.. I've set it to: src/js/bower_components/ From src . ├── Gruntfile └── src └── js └── bower_components └── jquery I currently get: . ├── Gruntfile └── build └── assets └── js └── vendor src └── js └── bower_components └── jquery What I'd like . ├── Gruntfile └── build └── assets └── js └── vendor └──jquery Here's my current grunt task copy: { main: { src: 'src/js