Skip to content

feat(gen): consolidate templates, convert html to pug during write #2394

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 25, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,17 +37,19 @@
"dependencies": {
"babel-core": "^6.18.2",
"babel-eslint": "^7.1.0",
"babel-register": "^6.18.0",
"babel-plugin-syntax-class-properties": "^6.13.0",
"babel-plugin-syntax-flow": "^6.18.0",
"babel-plugin-transform-flow-strip-types": "^6.18.0",
"babel-register": "^6.18.0",
"bluebird": "^3.4.5",
"chalk": "^1.1.0",
"glob": "^7.0.5",
"gulp-babel": "^6.1.2",
"gulp-beautify": "^2.0.0",
"gulp-eslint": "^3.0.1",
"gulp-filter": "^4.0.0",
"gulp-html2jade": "^1.1.2",
"gulp-rename": "^1.2.2",
"gulp-tap": "^0.1.3",
"insight": "~0.8.3",
"lodash": "^4.17.0",
Expand Down
20 changes: 20 additions & 0 deletions src/generators/app/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ import beaufityStream from 'gulp-beautify';
import tap from 'gulp-tap';
import filter from 'gulp-filter';
import eslint from 'gulp-eslint';
import html2jade from 'gulp-html2jade';
import rename from 'gulp-rename';
import semver from 'semver';

export class Generator extends Base {
Expand Down Expand Up @@ -543,6 +545,24 @@ export class Generator extends Base {
]);
}

// Convert HTML into Pug
if(this.filters.pug) {
let pugFilter = filter(['**/*.html'], {restore: true});
this.registerTransformStream([
pugFilter,
html2jade({
nspaces: 2,
noemptypipe: true,
bodyless: true,
}),
rename(path => {
path.extname = '.pug';
}),
pugFilter.restore
]);
}

// ESLint fix server files
let serverJsFilter = filter(['server/**/*.js'], {restore: true});
this.registerTransformStream([
serverJsFilter,
Expand Down
45 changes: 0 additions & 45 deletions templates/app/client/app/account(auth)/login/login(pug).pug

This file was deleted.

35 changes: 0 additions & 35 deletions templates/app/client/app/account(auth)/settings/settings(pug).pug

This file was deleted.

63 changes: 0 additions & 63 deletions templates/app/client/app/account(auth)/signup/signup(pug).pug

This file was deleted.

10 changes: 0 additions & 10 deletions templates/app/client/app/admin(auth)/admin(pug).pug

This file was deleted.

22 changes: 0 additions & 22 deletions templates/app/client/app/main/main(pug).pug

This file was deleted.

11 changes: 0 additions & 11 deletions templates/app/client/components/footer/footer(pug).pug

This file was deleted.

34 changes: 0 additions & 34 deletions templates/app/client/components/navbar/navbar(pug).pug

This file was deleted.

This file was deleted.

Loading