Questions tagged [grunt-contrib-concat]

Concatenate many files into one

Grunt task to concatenate many files into one

174 questions
39
votes
2 answers

Why is it recommended to use concat then uglify when the latter can do both?

I keep seeing the recommendation for making JS files ready for production to be concat then uglify. For example here, in on of Yeoman's grunt tasks. By default the flow is: concat -> uglifyjs. Considering UglifyJS can do both concatenation and…
Francisc
  • 77,430
  • 63
  • 180
  • 276
34
votes
2 answers

Grunt concat + uglify with sourcemaps

I use concat to merge JS files into one file and uglify to minimize the JavaScript. How can I create a sourcemaps file that uses the source JS files? My current gruntfile: concat: { options: { // define a string to put between each file…
19
votes
1 answer

Using grunt to concat many files from many dirs into single renamed file in new directory

I have an Angular project with potentially many modules. Each module has it's own directory with subdirectories for controllers, directives, services, etc. Something like this: src |-- js |-- modules |-- moduleOne |…
coblr
  • 3,008
  • 3
  • 23
  • 31
16
votes
1 answer

Relative paths in CSS and Grunt minification?

Before I ask this question I want to point out that there are several similar questions posted here on StackOverflow, but none of them provide an accurate solution to the problem. The problem I have a workflow setup where Grunt combines and…
Joel Murphy
  • 2,472
  • 3
  • 29
  • 47
13
votes
1 answer

requires a peer of grunt@>=0.4.0

Why do I get the error below? My grunt version is > v0.4.0 npm install grunt-contrib-concat --save-dev +-- UNMET PEER DEPENDENCY grunt@>=0.4.0 Error messages: ..Projects\Hartz\Hartz>npm install grunt-contrib-concat --save-dev Hartz@1.0.0…
Legends
  • 21,202
  • 16
  • 97
  • 123
12
votes
1 answer

Grunt babel multiple files and preserve source mapping

I am trying, using grunt and babel, to transpile all js6 files in a folder and end up with a concatenated single file (js5) with a working sourcemap to the original es6 files. However the sourcemapping does not work. My babel, concat settings…
Todilo
  • 1,256
  • 3
  • 19
  • 38
9
votes
1 answer

Running multiple Grunt tasks of the same task type

I need to be able to run multiple tasks of the same type of task within Grunt (grunt-contrib-concat). I've tried a couple of things below but neither work. Any ideas on how to do this are appreciated. concat: { dist: { src: [ …
user2565123
  • 293
  • 1
  • 5
  • 12
8
votes
3 answers

How can I skip a grunt task if a directory is empty

I'm using grunt-contrib's concat and uglify modules to process some javascript. Currently if src/js/ is empty, they will still create an (empty) concat'd file, along with the minified version and a source map. I want to task to detect if the…
jtfairbank
  • 2,311
  • 2
  • 21
  • 33
7
votes
3 answers

Gruntjs: replace templates when copying a file

I am writing a Gruntjs script which should concatenate + replace template of some JS files into target directory (contrib-concat) copies + replace template of some other files (contrib-copy) package the files into a zip file contrib-concat has a…
6
votes
0 answers

Angular 2 Concat and minify with Grunt

I love using Grunt for concatenating and minifying plugins etc.. can someone please tell me how to do this task on Angular 2's node_modules.. i want to end up with 1 file that is minified and concatenated.. I have tried webpack etc and gulp…
Kravitz
  • 2,769
  • 6
  • 26
  • 53
6
votes
1 answer

Grunt tasks stuck in endless loop

Working on putting together a base Gruntfile.js for some upcoming projects. Starting in on a new computer so everything has been a fresh build. Installed Node and NPM using Homebrew, and then installed Grunt globally, as well as in my local…
5
votes
2 answers

Is 'El Capitan's' rootless breaking old grunt configs?

After migrating to El Capitan, it seems users are experiencing an issue with grunt installations, possibly related to the rootless changes of El Capitan. In particular, running the grunt --force command results in EPERM errors. The workflow is as…
5
votes
1 answer

Using Grunt to concat multiple js files but want them split?

I am new to grunt (literally installed it today and using it) and its great, but i cannot work out something. I have an angularJs project and i would like to concat all my javascript files into 3 files overall. So i would have "base" - all the…
Gillardo
  • 9,518
  • 18
  • 73
  • 141
4
votes
1 answer

How to make uglify and grunt index all imports and generate one single file

I have just started using grunt and I want it to use combine all files and uglify them. But my issues is that it combines and uglifys, but it doesn't remove import statements. (I'm using uglify and concat) What I want - // File.js import something…
USER2
  • 59
  • 5
4
votes
1 answer

Concatenating php files and Javascript with Grunt.js

I am having an issue trying to get my Grunt.js file to work. Currently I have it set up to just concatenate all my php function files, and decided since a lot of my work projects use Bootstrap, to concatenate only the javascript files I'll be using.…
Ishio
  • 755
  • 2
  • 9
  • 29
1
2 3
11 12