Skip to content

Commit f6deb25

Browse files
committed
feat(gen): consolidate templates, convert html to pug during write
1 parent 66ea123 commit f6deb25

File tree

20 files changed

+23
-368
lines changed

20 files changed

+23
-368
lines changed

package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,17 +37,19 @@
3737
"dependencies": {
3838
"babel-core": "^6.18.2",
3939
"babel-eslint": "^7.1.0",
40-
"babel-register": "^6.18.0",
4140
"babel-plugin-syntax-class-properties": "^6.13.0",
4241
"babel-plugin-syntax-flow": "^6.18.0",
4342
"babel-plugin-transform-flow-strip-types": "^6.18.0",
43+
"babel-register": "^6.18.0",
4444
"bluebird": "^3.4.5",
4545
"chalk": "^1.1.0",
4646
"glob": "^7.0.5",
4747
"gulp-babel": "^6.1.2",
4848
"gulp-beautify": "^2.0.0",
4949
"gulp-eslint": "^3.0.1",
5050
"gulp-filter": "^4.0.0",
51+
"gulp-html2jade": "^1.1.2",
52+
"gulp-rename": "^1.2.2",
5153
"gulp-tap": "^0.1.3",
5254
"insight": "~0.8.3",
5355
"lodash": "^4.17.0",

src/generators/app/index.js

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ import beaufityStream from 'gulp-beautify';
1414
import tap from 'gulp-tap';
1515
import filter from 'gulp-filter';
1616
import eslint from 'gulp-eslint';
17+
import html2jade from 'gulp-html2jade';
18+
import rename from 'gulp-rename';
1719
import semver from 'semver';
1820

1921
export class Generator extends Base {
@@ -543,6 +545,24 @@ export class Generator extends Base {
543545
]);
544546
}
545547

548+
// Convert HTML into Pug
549+
if(this.filters.pug) {
550+
let pugFilter = filter(['**/*.html'], {restore: true});
551+
this.registerTransformStream([
552+
pugFilter,
553+
html2jade({
554+
nspaces: 2,
555+
noemptypipe: true,
556+
bodyless: true,
557+
}),
558+
rename(path => {
559+
path.extname = '.pug';
560+
}),
561+
pugFilter.restore
562+
]);
563+
}
564+
565+
// ESLint fix server files
546566
let serverJsFilter = filter(['server/**/*.js'], {restore: true});
547567
this.registerTransformStream([
548568
serverJsFilter,

templates/app/client/app/account(auth)/login/login(pug).pug

Lines changed: 0 additions & 45 deletions
This file was deleted.

templates/app/client/app/account(auth)/settings/settings(pug).pug

Lines changed: 0 additions & 35 deletions
This file was deleted.

templates/app/client/app/account(auth)/signup/signup(pug).pug

Lines changed: 0 additions & 63 deletions
This file was deleted.

templates/app/client/app/admin(auth)/admin(pug).pug

Lines changed: 0 additions & 10 deletions
This file was deleted.

0 commit comments

Comments
 (0)