Skip to content

Commit 5729ed5

Browse files
committed
Gulp file formatting, package content update
1 parent 67caf21 commit 5729ed5

File tree

2 files changed

+90
-89
lines changed

2 files changed

+90
-89
lines changed

app/templates/_gulpfile.js

Lines changed: 86 additions & 82 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
'use strict';
22
/*-----------------------------------------------------------
3-
GULP: DEPENDENCIES DEFINTION
3+
GULP: DEPENDENCIES
4+
Define the variables of your dependencies in this section
45
-----------------------------------------------------------*/
56
var gulp = require('gulp'),
67
del = require('del'),
@@ -19,7 +20,8 @@ var gulp = require('gulp'),
1920
var plugins = gulploadPlugins();
2021

2122
/*-----------------------------------------------------------
22-
GULP: CONFIGURATION
23+
GULP: APP CONFIGURATION
24+
Source, Build folder and other application configuration
2325
-----------------------------------------------------------*/
2426
// Source Path
2527
var src = {
@@ -73,37 +75,33 @@ var opts = {
7375

7476
// Chalk config
7577
var error = chalk.red.bold,
76-
warning = chalk.yellow.bold,
77-
update = chalk.blue,
78+
warning = chalk.black.bold.bgYellow,
79+
update = chalk.yellow.underline,
7880
success = chalk.green;
7981

8082
/*-----------------------------------------------------------
81-
GULP: TASKS
82-
-----------------------------------------------------------*/
83-
/*-----------------------------------------------------------
84-
GULP: TASKS :: List all gulp tasks
85-
-----------------------------------------------------------*/
86-
87-
gulp.task('help', plugins.taskListing);
88-
89-
/*-----------------------------------------------------------
90-
GULP: TASKS :: Start server and live reload
83+
GULP : APP TASKS
84+
Necessary gulp tasks required to run your application like
85+
magic. Feel free to add more tasks in this area
9186
-----------------------------------------------------------*/
87+
/*===========================================================
88+
GULP : APP TASKS :: Start server and live reload
89+
===========================================================*/
9290

9391
gulp.task('server', function () {
9492

95-
console.log(update('\n --------- Server started at http://localhost:'+ serverConfiguration.port +' ------------------------ \n'));
93+
console.log(update('\n--------- Server started at http://localhost:'+ serverConfiguration.port +' ------------------------\n'));
9694
return gulp.src('build')
9795
.pipe(plugins.webserver(serverConfiguration));
9896
});
9997

100-
/**================================================
101-
GULP: TASKS :: HTML -- minify html to build
102-
===================================================*/
98+
/*===========================================================
99+
GULP : APP TASKS :: HTML -- Minify html to build
100+
===========================================================*/
103101

104102
gulp.task('html', function () {
105103

106-
console.log(update('\n --------- Running HTML tasks ------------------------------------------ \n '));
104+
console.log(update('\n--------- Running HTML tasks ------------------------------------------\n'));
107105
return gulp.src([src.root + '/*.html', src.root + '/**/*.html'])
108106
.pipe(gulpIf(production, plugins.minifyHtml(opts)))
109107
.pipe(plugins.fileInclude({
@@ -114,18 +112,18 @@ gulp.task('html', function () {
114112
.pipe(gulp.dest(build.root));
115113
});
116114

117-
/**================================================
118-
GULP: TASKS :: CSS & SASS -- minify, concat
119-
===================================================*/
115+
/*===========================================================
116+
GULP : APP TASKS :: CSS & SASS -- minify, concat
117+
===========================================================*/
120118

121119
var callback = function (err) {
122-
console.log(error('\n SASS file has error clear it to see changes, check the log below ------------- \n'));
120+
console.log(error('\n--------- SASS file has error clear it to see changes, check the log below -------------\n'));
123121
console.log(error(err));
124122
};
125123

126124
gulp.task('sass', function () {
127125

128-
console.log(update('\n --------- Running SASS tasks -------------------------------------------'));
126+
console.log(update('\n--------- Running SASS tasks -------------------------------------------'));
129127
return gulp.src(['app/scss/master.scss'])
130128
.pipe(plugins.sass({ onError: callback }))
131129
.pipe(plugins.size())
@@ -134,29 +132,29 @@ gulp.task('sass', function () {
134132

135133
gulp.task('fonts', function () {
136134

137-
console.log(update('\n --------- Running Fonts tasks --------------------------------------------'));
135+
console.log(update('\n--------- Running Fonts tasks --------------------------------------------\n'));
138136
return gulp.src([src.fonts + '/*.*', src.fonts + '/**/*.*'])
139137
.pipe(plugins.size())
140138
.pipe(gulp.dest(build.fonts));
141139
});
142140

143141
gulp.task('css', ['sass', 'fonts'], function () {
144142

145-
console.log(update('\n --------- Running CSS tasks --------------------------------------------'));
143+
console.log(update('\n--------- Running CSS tasks --------------------------------------------\n'));
146144
return gulp.src([src.css + '/**/*.css'])
147145
.pipe(gulpIf(production, plugins.minifyCss()))
148146
.pipe(plugins.concat('master.css'))
149147
.pipe(plugins.size())
150148
.pipe(gulp.dest(build.css));
151149
});
152150

153-
/**================================================
154-
GULP: TASKS :: Script -- js hint & uglify & concat
155-
===================================================*/
151+
/*===========================================================
152+
GULP: APP TASKS :: Script -- js hint, uglify & concat
153+
===========================================================*/
156154

157155
gulp.task('scripts', function () {
158156

159-
console.log(update('\n --------- Running SCRIPT tasks -----------------------------------------'));
157+
console.log(update('\n--------- Running SCRIPT tasks -----------------------------------------\n'));
160158
return gulp.src([src.js + '/*.js', src.js + '/**/*.js'])
161159
.pipe(plugins.jshint('.jshintrc'))
162160
.pipe(plugins.jshint.reporter(jshintStylish))
@@ -166,13 +164,13 @@ gulp.task('scripts', function () {
166164
.pipe(gulp.dest(build.js));
167165
});
168166

169-
/**================================================
170-
Concat - all bower packages
171-
===================================================*/
167+
/*===========================================================
168+
GULP: APP TASKS :: Concat - all bower packages
169+
===========================================================*/
172170

173171
gulp.task('concat-bower', function () {
174172

175-
console.log(update('\n --------- Bower Concat ------------------------------------------------->>> \n'));
173+
console.log(update('\n--------- Bower Concat -------------------------------------------------\n'));
176174
var jsFilter = plugins.filter('**/*.js'),
177175
cssFilter = plugins.filter('**/*.css'),
178176
fontsFilter = plugins.filter(['**/fonts/**.*']);
@@ -202,27 +200,26 @@ gulp.task('concat-bower', function () {
202200
.pipe(fontsFilter.restore());
203201
});
204202

205-
206-
/**================================================
207-
Images minification
208-
===================================================*/
203+
/*===========================================================
204+
GULP: APP TASKS :: Images minification
205+
===========================================================*/
209206

210207
gulp.task('img-min', function () {
211208

212-
console.log(update('\n --------- Image Minification -------------------------------------------- \n'));
209+
console.log(update('\n--------- Image Minification --------------------------------------------\n'));
213210
return gulp.src([src.images + '/*.*', src.images + '/**/*.*'])
214211
.pipe(plugins.imagemin())
215212
.pipe(plugins.size())
216213
.pipe(gulp.dest(build.images));
217214
});
218215

219-
/**===============================================
220-
Watch -- all files
221-
=================================================*/
216+
/*===========================================================
217+
GULP: APP TASKS :: Watch -- all files
218+
===========================================================*/
222219

223220
gulp.task('watch', function () {
224221

225-
console.log(update('\n --------- Watching All Files ------------------------------------------- \n'));
222+
console.log(update('\n--------- Watching All Files -------------------------------------------\n'));
226223
var HTML = gulp.watch(['app/*.html', 'app/**/*.html'], ['html']),
227224
JS = gulp.watch(['app/*.js', 'app/js/**/*.js'], ['scripts']),
228225
CSS = gulp.watch(['app/*.css', 'app/css/**/*.css'], ['css']),
@@ -238,7 +235,7 @@ gulp.task('watch', function () {
238235
runSequence('html', 'scripts', 'css', 'watch');
239236
}, 500);
240237
}
241-
console.log(change('\n -- File ' + event.path + ' was ' + event.type + ' -->>>'));
238+
console.log(change('\n--------- File ' + event.path + ' was ' + event.type + ' ------------------------\n'));
242239
};
243240

244241
//on change print file name and event type
@@ -251,21 +248,9 @@ gulp.task('watch', function () {
251248
BOWER.once('update', log);
252249
});
253250

254-
/**================================================
255-
Clean - remove files and folder in build
256-
===================================================*/
257-
258-
gulp.task('clean', function () {
259-
console.log(update('\n --------- Clean:Build Folder ------------------------------------------>>> \n'));
260-
261-
del('build/', function (err) {
262-
console.log(update('All are files deleted from the build folder'));
263-
});
264-
});
265-
266-
/**================================================
267-
Browser sync to sync with browser
268-
==================================================*/
251+
/*==========================================================
252+
GULP: APP TASKS :: Browser sync to sync with browser
253+
===========================================================*/
269254

270255
gulp.task('browser-sync', function () {
271256
browserSync.init([build.root + '*/*.*', build.root + '**/*.*'],
@@ -274,40 +259,59 @@ gulp.task('browser-sync', function () {
274259
});
275260
});
276261

277-
/**================================================
278-
Zip all build files with date
279-
==================================================*/
280-
281-
gulp.task('zip', function () {
282-
var date = new Date().toDateString();
283-
284-
console.log(update('\n --------- Zipping Build Files ------------------------------------------>>> \n'));
285-
return gulp.src([build.root + '/**/*'])
286-
.pipe(plugins.zip('<%= site_name %> - ' + date + '.zip'))
287-
.pipe(plugins.size())
288-
.pipe(gulp.dest('./zip/'));
289-
});
290-
291-
/**===============================================
292-
Gulp build Tasks - dev, production
293-
=================================================*/
262+
/*-----------------------------------------------------------
263+
GULP : ENVIRONMENT
264+
Set your environment here, as of now it's development and
265+
production. You can also include testing and staging
266+
-----------------------------------------------------------*/
267+
/*==========================================================
268+
GULP: ENVIRONMENT :: Gulp build Tasks - dev, production
269+
===========================================================*/
294270

295271
gulp.task('build', function () {
296272

297-
console.log(update('\n --------- Build Development Mode -------------------------------------->>> \n'));
273+
console.log(update('\n--------- Build Development Mode --------------------------------------\n'));
298274
runSequence('html', 'scripts', 'css', 'img-min', 'concat-bower', 'server', 'watch');
299275
});
300276

301277
gulp.task('prod', function () {
302278

303-
console.log(update('\n --------- Build Production Mode --------------------------------------->>> \n'));
279+
console.log(update('\n--------- Build Production Mode ---------------------------------------\n'));
304280
production = true;
305281
runSequence('html', 'scripts', 'css', 'img-min', 'concat-bower', 'server', 'watch');
306282
});
307283

284+
/*==========================================================
285+
GULP: ENVIRONMENT :: Gulp Default Tasks -- build
286+
===========================================================*/
287+
288+
gulp.task('default', ['build']);
289+
290+
291+
/*-----------------------------------------------------------
292+
GULP : HELPERS
293+
Quick tasks to make your life easier!
294+
-----------------------------------------------------------*/
295+
296+
// GULP: HELPERS :: List all gulp tasks
297+
gulp.task('help', plugins.taskListing);
298+
299+
// GULP: HELPERS :: Clean - remove files and folder in build
300+
gulp.task('clean', function () {
301+
console.log(update('\n--------- Clean:Build Folder ------------------------------------------\n'));
302+
303+
del('build/', function (err) {
304+
console.log(update('All are files deleted from the build folder'));
305+
});
306+
});
308307

309-
/**==============================================
310-
Gulp Default Tasks -- build
311-
=================================================*/
308+
// GULP: HELPERS :: Zip all build files with date
309+
gulp.task('zip', function () {
310+
var date = new Date().toDateString();
312311

313-
gulp.task('default', ['build']);
312+
console.log(update('\n--------- Zipping Build Files ------------------------------------------\n'));
313+
return gulp.src([build.root + '/**/*'])
314+
.pipe(plugins.zip('<%= site_name %> - ' + date + '.zip'))
315+
.pipe(plugins.size())
316+
.pipe(gulp.dest('./zip/'));
317+
});

package.json

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33
"version": "0.1.0",
44
"description": "Perfectionist Frontend Generator",
55
"author": {
6-
"name": "",
7-
"email": "",
8-
"url": ""
6+
"name": "Logesh Paul",
7+
"email": "logeshpaul@gmail.com",
8+
"url": "https://github.com/logeshpaul"
99
},
1010
"licenses": [
1111
{
@@ -25,7 +25,7 @@
2525
"bugs": "https://github.com/FuelFrontend/generator-smacss/issues",
2626
"repository": {
2727
"type": "git",
28-
"url": ""
28+
"url": "git@github.com:FuelFrontend/generator-smacss.git"
2929
},
3030
"scripts": {
3131
"test": "mocha --reporter spec"
@@ -34,9 +34,6 @@
3434
"node": ">=0.10.0",
3535
"npm": ">=1.3"
3636
},
37-
"files": [
38-
"app"
39-
],
4037
"dependencies": {
4138
"yeoman-generator": "^0.17.3",
4239
"chalk": "~0.4.0",

0 commit comments

Comments
 (0)