Skip to content

Commit cd0b596

Browse files
committed
optional jade
1 parent 6f84b9a commit cd0b596

File tree

9 files changed

+52
-14
lines changed

9 files changed

+52
-14
lines changed

generators/app/index.js

+9-3
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,6 @@ var ManGenerator = yeoman.generators.Base.extend({
9494
// Application files
9595
utils.generate.appfiles.bind(this)();
9696
},
97-
// ,
9897

9998
writing: {
10099
base: function () {
@@ -107,7 +106,10 @@ var ManGenerator = yeoman.generators.Base.extend({
107106
// Assets directories
108107
utils.generate.assets.bind(this)();
109108

110-
// // Template files
109+
// sprites template
110+
utils.generate.spritesmith.bind(this)();
111+
112+
// Template files
111113
// utils.generate.templateFiles.bind(this)();
112114

113115
// Styles
@@ -116,7 +118,11 @@ var ManGenerator = yeoman.generators.Base.extend({
116118
// JS
117119
utils.generate.js.bind(this)();
118120

119-
if (this.prompts.features.jade) {
121+
if (this.prompts.iconfont) {
122+
utils.generate.iconfont.bind(this)();
123+
}
124+
125+
if (this.prompts.jade) {
120126
utils.generate.jade.bind(this)();
121127
} else{
122128
utils.generate.html.bind(this)();

generators/app/templates/_package.json

+6
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,12 @@
1717
"gulp-iconfont": "^5.0.0",
1818
"gulp-include": "^2.0.3",
1919
"gulp-notify": "^2.2.0",
20+
<% if (jade) { %>
21+
"gulp-jade": "^1.1.0",
22+
"gulp-plumber": "*",
23+
<% } %>
24+
25+
2026
"gulp-postcss": "~6.0.0",
2127
"gulp-ruby-sass": "~2.0.3",
2228
"gulp-sourcemaps": "^1.5.2",

generators/app/templates/gulp/tasks/jade.js

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
1+
<% if (jade) { %>
12
var gulp = require('gulp');
23
var notify = require('gulp-notify');
34
var plumber = require("gulp-plumber");
45
var jade = require("gulp-jade");
56
var config = require('../config');
67
// var changed = require("gulp-changed");
78

9+
810
gulp.task('jade', function() {
911
return gulp.src([
1012
config.src.jade + '/*.jade',
@@ -30,4 +32,5 @@ gulp.task('jade-all', function() {
3032
gulp.task('jade:watch', function() {
3133
gulp.watch(config.src.jade + '/**/*.jade', ['jade']);
3234
gulp.watch([config.src.jade + '/_*.jade', config.src.jade + '/includes/*.jade'], ['jade-all']);
33-
});
35+
});
36+
<% } %>

generators/app/templates/gulp/tasks/watch.js

+10-2
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ gulp.task('watch', [
77
'sass:watch',
88
'copy:watch',
99
'html:watch',
10-
'jade:watch',
10+
<% if (jade) { %>'jade:watch', <% } %>
1111
'font:watch',
1212
'js:watch'
1313
]);
@@ -17,4 +17,12 @@ gulp.task('delete', function (cb) {
1717
rimraf('./'+config.dest.root, cb);
1818
});
1919
gulp.task('default', ['server', 'watch'], function() {});
20-
gulp.task('build', ['html','font','sprite','copy','js','sass'], function() {});
20+
gulp.task('build', [
21+
'html',
22+
<% if (jade) { %>'jade',<% } %>
23+
<% if (iconfont) { %>'font',<% } %>
24+
'sprite',
25+
'copy',
26+
'js',
27+
'sass'
28+
], function() {});

generators/app/templates/src/sass/style.sass

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
@import lib/mixins
33
@import lib/reset
44
@import lib/sprite
5-
@import lib/svgfont
5+
<% if (iconfont) { %>@import lib/svgfont <% } %>
66
// @import lib/slick
77
88
@import common

generators/app/utils/generate.js

+14-5
Original file line numberDiff line numberDiff line change
@@ -34,15 +34,15 @@ var generate = {
3434

3535
appfiles: function () {
3636
helpers.copy.call(this, '_package.json', 'package.json', this.prompts);
37+
console.log(this.prompts);
3738
// helpers.copy.call(this, '_bower.json', 'bower.json', this.prompts);
3839
},
3940

4041
gulpModules: function () {
4142
helpers.copy.call(this, 'gulpfile.js', 'gulpfile.js', this.prompts);
4243
helpers.copy.call(this, 'gulp/config.js', 'gulp/config.js', this.prompts);
43-
helpers.copy.call(this, 'gulp/helpers/_svgfont.sass', 'gulp/helpers/_svgfont.sass');
44-
helpers.copy.call(this, 'gulp/helpers/icons.html', 'gulp/helpers/icons.html');
45-
helpers.copy.call(this, 'gulp/helpers/sprite.template.mustache', 'gulp/helpers/sprite.template.mustache');
44+
45+
4646

4747

4848
var taskslist = ['sass','iconfont','copy', 'html','jade','spritesmith','watch', 'js','server'];
@@ -55,6 +55,15 @@ var generate = {
5555
}
5656
},
5757

58+
spritesmith: function () {
59+
helpers.copy.call(this, 'gulp/helpers/sprite.template.mustache', 'gulp/helpers/sprite.template.mustache');
60+
},
61+
62+
iconfont: function () {
63+
helpers.copy.call(this, 'gulp/helpers/_svgfont.sass', 'gulp/helpers/_svgfont.sass');
64+
helpers.copy.call(this, 'gulp/helpers/icons.html', 'gulp/helpers/icons.html');
65+
},
66+
5867
projectInfo: function () {
5968
// helpers.copy.call(this, '_index.html', 'index.html', this.prompts);
6069
helpers.copy.call(this, 'README.md', 'README.md', this.prompts);
@@ -63,8 +72,8 @@ var generate = {
6372
assets: function () {
6473
helpers.copy.call(this, 'src/.keep', 'src/fonts/.keep');
6574
helpers.copy.call(this, 'src/.keep', 'src/img/.keep');
66-
helpers.copy.call(this, 'src/.keep', 'src/img/icons/.keep');
67-
helpers.copy.call(this, 'src/.keep', 'src/img/svg/.keep');
75+
helpers.copy.call(this, 'src/img/icons/coderiver.png', 'src/img/icons/coderiver.png');
76+
helpers.copy.call(this, 'src/img/svg/sepa.svg', 'src/img/svg/sepa.svg');
6877
},
6978

7079
// templateFiles: function () {

generators/app/utils/prompts.js

+6
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,12 @@ module.exports = {
1212
name: 'jade',
1313
message: 'Do we need Jade?',
1414
default: false
15+
},
16+
{
17+
type: 'confirm',
18+
name: 'iconfont',
19+
message: 'Create iconfont from SVG?',
20+
default: true
1521
}],
1622

1723
update: [{

generators/app/utils/setPrompts.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ module.exports = function (answers) {
66
this.prompts = {};
77
this.prompts.projectName = answers.projectName;
88
this.prompts.spritesmith = answers.spritesmith;
9-
this.prompts.bootstrap = answers.bootstrap;
10-
// this.prompts.cssPreprocessor = answers.cssPreprocessor;
9+
this.prompts.jade = answers.jade;
10+
this.prompts.iconfont = answers.iconfont;
1111
// this.prompts.cssPrefix = answers.cssPreprocessor === 'scss' ? '_' : '';
1212
this.prompts.features = {};
1313

0 commit comments

Comments
 (0)