zl程序教程

您现在的位置是:首页 >  前端

当前栏目

[AngularJS + Gulp] Set up Gulp

set angularjs Up Gulp
2023-09-14 08:59:20 时间

We will have accomplished a few goals, the first goal being that changes to our source files will automatically be detected and a new build will be kicked off each time.

This will include compiling our less into CSS, running JSHint to catch any Javascript errors that we may have incurred, compiling our HTML partials into a single Javascript file, injecting the proper resources into our index.html file, and then serving that build up with express and nodemon.

We will take this a step further, when we want to kick off a production build, by concatenating our source files and then minifying and uglifying them, all the while keeping things safe by using ng-annotate.

 

To get started with gulp:

1. You need node and npm.

2. Install gulp gloablly:

npm install -g gulp

3. Install gulp locally:

npm install --save-dev gulp

4. Create a gulpfile.js

var gulp = require('gulp');

//Default task
gulp.task('default', function() {
    console.log("Hello Gulp");
});

5. In commend line, run:

gulp