-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathslushfile.js
91 lines (85 loc) · 2.49 KB
/
slushfile.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
'use strict'
var gulp = require('gulp'),
install = require('gulp-install'),
conflict = require('gulp-conflict'),
template = require('gulp-template'),
rename = require('gulp-rename'),
inquirer = require('inquirer');
gulp.task('default', function (done) {
inquirer.prompt([{
type: 'input',
name: 'name',
message: 'Give your app a name',
default: 'html5-template'
}, {
type: 'list',
name: 'cssFramework',
message: 'What framework of css do you want?',
choices: [{
name: "Pure CSS: No CSS Framework.",
value: "includeCss"
}, {
name: "Sass: Syntactically Awesome Style Sheets.",
value: "includeSass"
}, {
name: "Compass: CSS Authoring Framework.",
value: "includeCompass"
}
],
default: 0
}, {
type: 'checkbox',
name: 'features',
message: 'Which other options would you like to include?',
choices: [{
name: 'RequireJS',
value: 'includeRequireJS',
checked: true
}, {
name: 'Normalize-scss',
value: 'includeNormalizeCSS',
checked: true
}, {
name: 'Modernizr',
value: 'includeModernizr',
checked: true
}]
}, {
type: 'confirm',
name: 'moveon',
message: 'Continue?'}
],
function (answers) {
var hasFeature, src;
hasFeature = function (feat) {
return answers.features.indexOf(feat) !== -1;
};
if (!answers.moveon) {
return done();
}
answers.includeCss = (answers.cssFramework === 'includeCss') ? true : false;
answers.includeSass = (answers.cssFramework === 'includeSass') ? true : false;
answers.includeCompass = (answers.cssFramework === 'includeCompass') ? true : false;
answers.includeNormalizeCSS = hasFeature('includeNormalizeCSS');
answers.includeModernizr = hasFeature('includeModernizr');
answers.includeRequireJS = hasFeature('includeRequireJS');
if (answers.includeCss) {
src = [__dirname + '/templates/**', '!' + __dirname + '/templates/app/assets/sass/**/*']
} else {
src = [__dirname + '/templates/**', '!' + __dirname + '/templates/app/assets/css/**/*']
}
gulp.src(src)
.pipe(template(answers))
.pipe(rename(function (file) {
if (file.basename[0] === '_' && file.extname !== '.scss' ) {
file.basename = '.' + file.basename.slice(1);
}
}))
.pipe(conflict('./'))
.pipe(gulp.dest('./'))
.pipe(install())
.on('finish', function () {
done();
});
});
});