Answer the question
In order to leave comments, you need to log in
How to compress and concatenate js files with gulp?
Actually. I don't know which way to go.
As it was the old fashioned way: we create js files and include them either in a common template, or where necessary, independently monitoring the order in which they are included so that there are no errors. Then, before the deployment, we ourselves concatenate in the right order, compress, add the desired version so that there are no problems with caching.
And how to do it in a modern way, in order to automate everything as much as possible?
Here the gulpa watcher hangs, monitors coffee scripts, compiles them in a timely manner and puts them in the js daddy.
I just looked, there are such things as require.js, browserify - they seem to be able to load the necessary files on the fly, and then, when we build, they themselves will follow the dependencies and glue everything in the correct order. Did I understand correctly? I just don't understand how they work and where to attach them.
Tell us how your processes are built with gulp (well, or grunt) and what should I do to make everything go well?
Server in django. Frontend - coffeescript, angular, jquery, bootstrap.js.
Answer the question
In order to leave comments, you need to log in
The task of AMD / CommonJS (require.js and browserify, respectively) is to resolve dependencies and not dynamically load scripts.
Including scripts - gulp-inject + main-bower-files
Handling scripts - gulp-concat + gulp-uglify + gulp-sourcemaps (no sourcemaps)
Styling - gulp-less (or scss as you like) + gulp-autoprefixer + gulp -sourcemaps Tasks
that are usually available: build (preparation for production) and server (prebuild application for development and launch watchers).
There are many articles describing different approaches. There are all sorts of boilerplates and seeds. There is a yoman in the end with a bunch of generators.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question