Skip to content

Commit 1a2d356

Browse files
authored
Merge pull request #2394 from angular-fullstack/feat/generate-pug
feat(gen): consolidate templates, convert html to pug during write
2 parents e9b0f9c + f6deb25 commit 1a2d356

File tree

20 files changed

+23
-368
lines changed

20 files changed

+23
-368
lines changed

Diff for: package.json

+3-1
Original file line numberDiff line numberDiff line change
@@ -37,19 +37,21 @@
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-syntax-decorators": "^6.13.0",
4443
"babel-plugin-syntax-export-extensions": "^6.13.0",
4544
"babel-plugin-transform-flow-strip-types": "^6.18.0",
45+
"babel-register": "^6.18.0",
4646
"bluebird": "^3.4.5",
4747
"chalk": "^1.1.0",
4848
"glob": "^7.0.5",
4949
"gulp-babel": "^6.1.2",
5050
"gulp-beautify": "^2.0.0",
5151
"gulp-eslint": "^3.0.1",
5252
"gulp-filter": "^4.0.0",
53+
"gulp-html2jade": "^1.1.2",
54+
"gulp-rename": "^1.2.2",
5355
"gulp-tap": "^0.1.3",
5456
"insight": "~0.8.3",
5557
"jscodeshift": "^0.3.30",

Diff for: src/generators/app/index.js

+20
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ import beaufityStream from 'gulp-beautify';
1111
import tap from 'gulp-tap';
1212
import filter from 'gulp-filter';
1313
import eslint from 'gulp-eslint';
14+
import html2jade from 'gulp-html2jade';
15+
import rename from 'gulp-rename';
1416
import semver from 'semver';
1517
import jscodeshift from 'jscodeshift';
1618

@@ -540,6 +542,24 @@ export class Generator extends Base {
540542
]);
541543
}
542544

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

Diff for: templates/app/client/app/account(auth)/login/login(pug).pug

-45
This file was deleted.

Diff for: templates/app/client/app/account(auth)/settings/settings(pug).pug

-35
This file was deleted.

Diff for: templates/app/client/app/account(auth)/signup/signup(pug).pug

-63
This file was deleted.

Diff for: templates/app/client/app/admin(auth)/admin(pug).pug

-10
This file was deleted.

Diff for: templates/app/client/app/main/main(pug).pug

-22
This file was deleted.

Diff for: templates/app/client/components/footer/footer(pug).pug

-11
This file was deleted.

Diff for: templates/app/client/components/navbar/navbar(pug).pug

-34
This file was deleted.

Diff for: templates/app/client/components/oauth-buttons(oauth)/oauth-buttons(pug).pug

-14
This file was deleted.

0 commit comments

Comments
 (0)