Skip to content

Commit c67f1e5

Browse files
committed
refactor(gulp): Rename $ to plugins
1 parent 1e97764 commit c67f1e5

1 file changed

Lines changed: 39 additions & 39 deletions

File tree

app/templates/gulpfile.babel.js

Lines changed: 39 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
'use strict';
33

44
var gulp = require('gulp');
5-
var $ = require('gulp-load-plugins')();
5+
var plugins = require('gulp-load-plugins')();
66
var http = require('http');
77
var openURL = require('open');
88
var lazypipe = require('lazypipe');
@@ -57,7 +57,7 @@ var paths = {
5757
//////////////////////
5858

5959
function onServerLog(log) {
60-
console.log($.util.colors.white('[') + $.util.colors.yellow('nodemon') + $.util.colors.white('] ') + log.message);
60+
console.log(plugins.util.colors.white('[') + plugins.util.colors.yellow('nodemon') + plugins.util.colors.white('] ') + log.message);
6161
}
6262

6363
function checkAppReady(cb) {
@@ -90,21 +90,21 @@ function whenServerReady (cb) {
9090
////////////////////////
9191

9292
var lintScripts = lazypipe()<% if(filters.coffee) { %>
93-
.pipe($.coffeelint)
94-
.pipe($.coffeelint.reporter);<% } else { %>
95-
.pipe($.jshint, '.jshintrc')
96-
.pipe($.jshint.reporter, 'jshint-stylish');<% } %>
93+
.pipe(plugins.coffeelint)
94+
.pipe(plugins.coffeelint.reporter);<% } else { %>
95+
.pipe(plugins.jshint, '.jshintrc')
96+
.pipe(plugins.jshint.reporter, 'jshint-stylish');<% } %>
9797

9898
var styles = lazypipe()<% if(filters.stylus) { %>
99-
.pipe($.stylus, {
99+
.pipe(plugins.stylus, {
100100
use: [nib()],
101101
errors: true
102102
})<% } %><% if(filters.sass) { %>
103-
.pipe($.rubySass, {
103+
.pipe(plugins.rubySass, {
104104
style: 'expanded',
105105
precision: 10
106106
})<% } %>
107-
.pipe($.autoprefixer, 'last 1 version')
107+
.pipe(plugins.autoprefixer, 'last 1 version')
108108
.pipe(gulp.dest, '.tmp/styles');
109109

110110
///////////
@@ -119,7 +119,7 @@ gulp.task('styles', function () {
119119
gulp.task('coffee', function() {
120120
return gulp.src(paths.client.scripts)
121121
.pipe(lintScripts())
122-
.pipe($.coffee({bare: true}).on('error', $.util.log))
122+
.pipe(plugins.coffee({bare: true}).on('error', plugins.util.log))
123123
.pipe(gulp.dest('.tmp/scripts'));
124124
});<% } %>
125125

@@ -129,7 +129,7 @@ gulp.task('lint:scripts', function () {
129129
});
130130

131131
gulp.task('clean:tmp', function () {
132-
return gulp.src('.tmp', {read: false}).pipe($.clean());
132+
return gulp.src('.tmp', {read: false}).pipe(plugins.clean());
133133
});
134134

135135
gulp.task('start:client', [<% if(filters.coffee) { %>'coffee', <% } %>'styles'], function (callback) {
@@ -149,24 +149,24 @@ gulp.task('start:server', function () {
149149
gulp.task('watch', function () {
150150
var testFiles = paths.client.test.concat(paths.server.test);
151151

152-
$.watch({glob: paths.client.styles})
153-
.pipe($.plumber())
152+
plugins.watch({glob: paths.client.styles})
153+
.pipe(plugins.plumber())
154154
.pipe(styles())
155-
.pipe($.livereload());
155+
.pipe(plugins.livereload());
156156

157-
$.watch({glob: paths.views.files})
158-
.pipe($.plumber())
159-
.pipe($.livereload());
157+
plugins.watch({glob: paths.views.files})
158+
.pipe(plugins.plumber())
159+
.pipe(plugins.livereload());
160160

161-
$.watch({glob: paths.client.scripts})
162-
.pipe($.plumber())
161+
plugins.watch({glob: paths.client.scripts})
162+
.pipe(plugins.plumber())
163163
.pipe(lintScripts())<% if(filters.coffee) { %>
164-
.pipe($.coffee({bare: true}).on('error', $.util.log))
164+
.pipe(plugins.coffee({bare: true}).on('error', plugins.util.log))
165165
.pipe(gulp.dest('.tmp/scripts'))<% } %>
166-
.pipe($.livereload());
166+
.pipe(plugins.livereload());
167167

168-
$.watch({glob: paths.server.scripts.concat(testFiles)})
169-
.pipe($.plumber())
168+
plugins.watch({glob: paths.server.scripts.concat(testFiles)})
169+
.pipe(plugins.plumber())
170170
.pipe(lintScripts());
171171

172172
gulp.watch('bower.json', ['bower']);
@@ -182,13 +182,13 @@ gulp.task('serve', function (callback) {
182182
gulp.task('test:server', function () {
183183
process.env.NODE_ENV = 'test';
184184
return gulp.src(paths.server.test)
185-
.pipe($.mocha({reporter: 'spec'}));
185+
.pipe(plugins.mocha({reporter: 'spec'}));
186186
});
187187

188188
gulp.task('test:client', function () {
189189
var testFiles = paths.client.testRequire.concat(paths.client.test)
190190
gulp.src(testFiles)
191-
.pipe($.karma({
191+
.pipe(plugins.karma({
192192
configFile: paths.karma,
193193
action: 'watch'
194194
}));
@@ -215,28 +215,28 @@ gulp.task('build', function (callback) {
215215
});
216216

217217
gulp.task('clean:dist', function () {
218-
return gulp.src('dist', {read: false}).pipe($.clean());
218+
return gulp.src('dist', {read: false}).pipe(plugins.clean());
219219
});
220220

221221
gulp.task('client:build', ['html'], function () {
222-
var jsFilter = $.filter('**/*.js');
223-
var cssFilter = $.filter('**/*.css');<% if(filters.jade) { %>
224-
var assets = $.filter('**/*.{js,css}');<% } %>
222+
var jsFilter = plugins.filter('**/*.js');
223+
var cssFilter = plugins.filter('**/*.css');<% if(filters.jade) { %>
224+
var assets = plugins.filter('**/*.{js,css}');<% } %>
225225

226226
return gulp.src(paths.views.main)<% if(filters.jade) { %>
227-
.pipe($.jade({pretty: true}))<% } %>
228-
.pipe($.useref.assets({searchPath: [yeoman.app, '.tmp']}))
227+
.pipe(plugins.jade({pretty: true}))<% } %>
228+
.pipe(plugins.useref.assets({searchPath: [yeoman.app, '.tmp']}))
229229
.pipe(jsFilter)
230-
.pipe($.ngmin())
231-
.pipe($.uglify())
230+
.pipe(plugins.ngmin())
231+
.pipe(plugins.uglify())
232232
.pipe(jsFilter.restore())
233233
.pipe(cssFilter)
234-
.pipe($.minifyCss({cache: true}))
234+
.pipe(plugins.minifyCss({cache: true}))
235235
.pipe(cssFilter.restore())
236-
.pipe($.rev())
237-
.pipe($.useref.restore())
238-
.pipe($.revReplace())
239-
.pipe($.useref())<% if(filters.jade) { %>
236+
.pipe(plugins.rev())
237+
.pipe(plugins.useref.restore())
238+
.pipe(plugins.revReplace())
239+
.pipe(plugins.useref())<% if(filters.jade) { %>
240240
.pipe(assets)<% } %>
241241
.pipe(gulp.dest(yeoman.dist + '/public'));
242242
});
@@ -248,7 +248,7 @@ gulp.task('html', function () {
248248

249249
gulp.task('images', function () {
250250
return gulp.src(yeoman.app + '/images/**/*')
251-
.pipe($.cache($.imagemin({
251+
.pipe(plugins.cache(plugins.imagemin({
252252
optimizationLevel: 5,
253253
progressive: true,
254254
interlaced: true

0 commit comments

Comments
 (0)