diff --git a/package.json b/package.json index da3ea884e..901d7d246 100644 --- a/package.json +++ b/package.json @@ -37,10 +37,10 @@ "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", @@ -48,6 +48,8 @@ "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", diff --git a/src/generators/app/index.js b/src/generators/app/index.js index a28f5336c..979e66b70 100644 --- a/src/generators/app/index.js +++ b/src/generators/app/index.js @@ -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 { @@ -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, diff --git a/templates/app/client/app/account(auth)/login/login(pug).pug b/templates/app/client/app/account(auth)/login/login(pug).pug deleted file mode 100644 index a463419d4..000000000 --- a/templates/app/client/app/account(auth)/login/login(pug).pug +++ /dev/null @@ -1,45 +0,0 @@ -.container - .row - .col-sm-12 - h1 Login - p - | Accounts are reset on server restart from - code server/config/seed.js - | . Default account is - code test@example.com - | / - code test - p - | Admin account is - code admin@example.com - | / - code admin - - .col-sm-12 - form.form(name='form', ng-submit='vm.login(form)', novalidate='') - .form-group - label Email - input.form-control(type='email', name='email', ng-model='vm.user.email') - .form-group - label Password - input.form-control(type='password', name='password', ng-model='vm.user.password') - - .form-group.has-error - p.help-block(ng-show='form.email.$error.required && form.password.$error.required && vm.submitted') - | Please enter your email and password. - p.help-block {{ vm.errors.login }} - - div - button.btn.btn-inverse.btn-lg.btn-login(type='submit') - | Login - = ' ' - a.btn.btn-default.btn-lg.btn-register(<% if (filters.uirouter) { %>ui-sref='signup'<% } else { %>href='/signup'<% } %>) - | Register -<% if (filters.oauth) {%> - hr - - .row - .col-sm-4.col-md-3 - oauth-buttons(classes='btn-block') -<% } %> - hr diff --git a/templates/app/client/app/account(auth)/login/login(html).html b/templates/app/client/app/account(auth)/login/login.html similarity index 100% rename from templates/app/client/app/account(auth)/login/login(html).html rename to templates/app/client/app/account(auth)/login/login.html diff --git a/templates/app/client/app/account(auth)/settings/settings(pug).pug b/templates/app/client/app/account(auth)/settings/settings(pug).pug deleted file mode 100644 index fc4bee87f..000000000 --- a/templates/app/client/app/account(auth)/settings/settings(pug).pug +++ /dev/null @@ -1,35 +0,0 @@ -.container - .row - .col-sm-12 - h1 Change Password - .col-sm-12 - form.form(name='form', ng-submit='vm.changePassword(form)', novalidate='') - .form-group - label Current Password - input.form-control(type='password' - name='password' - ng-model='vm.user.oldPassword' - mongoose-error='') - p.help-block(ng-show='form.password.$error.mongoose') - | {{ vm.errors.other }} - .form-group - label New Password - input.form-control(type='password' - name='newPassword' - ng-model='vm.user.newPassword' - ng-minlength='3', required='') - p.help-block(ng-show='(form.newPassword.$error.minlength || form.newPassword.$error.required) && (form.newPassword.$dirty || vm.submitted)') - | Password must be at least 3 characters. - .form-group - label Confirm New Password - input.form-control(type='password' - name='confirmPassword' - ng-model='vm.user.confirmPassword' - match="vm.user.newPassword" - ng-minlength='3', required='') - p.help-block(ng-show='fvm.orm.confirmPassword.$error.match && vm.submitted') - | Passwords must match. - - p.help-block {{ vm.message }} - - button.btn.btn-lg.btn-primary(type='submit') Save changes diff --git a/templates/app/client/app/account(auth)/settings/settings(html).html b/templates/app/client/app/account(auth)/settings/settings.html similarity index 100% rename from templates/app/client/app/account(auth)/settings/settings(html).html rename to templates/app/client/app/account(auth)/settings/settings.html diff --git a/templates/app/client/app/account(auth)/signup/signup(pug).pug b/templates/app/client/app/account(auth)/signup/signup(pug).pug deleted file mode 100644 index 51480eefb..000000000 --- a/templates/app/client/app/account(auth)/signup/signup(pug).pug +++ /dev/null @@ -1,63 +0,0 @@ -.container - .row - .col-sm-12 - h1 Sign up - .col-sm-12 - form.form(name='form', ng-submit='vm.register(form)', novalidate='') - .form-group(ng-class='{ "has-success": form.name.$valid && vm.submitted,\ - "has-error": form.name.$invalid && vm.submitted }') - label Name - input.form-control(type='text', name='name', ng-model='vm.user.name', required='') - p.help-block(ng-show='form.name.$error.required && vm.submitted') - | A name is required - - .form-group(ng-class='{ "has-success": form.email.$valid && vm.submitted,\ - "has-error": form.email.$invalid && vm.submitted }') - label Email - input.form-control(type='email', name='email', ng-model='vm.user.email', required='', mongoose-error='') - p.help-block(ng-show='form.email.$error.email && vm.submitted') - | Doesn't look like a valid email. - p.help-block(ng-show='form.email.$error.required && vm.submitted') - | What's your email address? - p.help-block(ng-show='form.email.$error.mongoose') - | {{ vm.errors.email }} - - .form-group(ng-class='{ "has-success": form.password.$valid && vm.submitted,\ - "has-error": form.password.$invalid && vm.submitted }') - label Password - input.form-control(type='password' - name='password' - ng-model='vm.user.password' - mongoose-error='' - ng-minlength='3', required='') - - p.help-block(ng-show='(form.password.$error.minlength || form.password.$error.required) && vm.submitted') - | Password must be at least 3 characters. - p.help-block(ng-show='form.password.$error.mongoose') - | {{ vm.errors.password }} - - .form-group(ng-class='{ "has-success": form.confirmPassword.$valid && vm.submitted,\ - "has-error": form.confirmPassword.$invalid && vm.submitted }') - label Confirm Password - input.form-control(type='password' - name='confirmPassword' - ng-model='vm.user.confirmPassword' - match="vm.user.password" - ng-minlength='3', required='') - p.help-block(ng-show='form.confirmPassword.$error.match && vm.submitted') - | Passwords must match. - - div - button.btn.btn-inverse.btn-lg.btn-register(type='submit') - | Sign up - = ' ' - a.btn.btn-default.btn-lg.btn-login(<% if (filters.uirouter) { %>ui-sref='login'<% } else { %>href='/login'<% } %>) - | Login -<% if (filters.oauth) {%> - hr - - .row - .col-sm-4.col-md-3 - oauth-buttons(classes='btn-block') -<% } %> - hr diff --git a/templates/app/client/app/account(auth)/signup/signup(html).html b/templates/app/client/app/account(auth)/signup/signup.html similarity index 100% rename from templates/app/client/app/account(auth)/signup/signup(html).html rename to templates/app/client/app/account(auth)/signup/signup.html diff --git a/templates/app/client/app/admin(auth)/admin(pug).pug b/templates/app/client/app/admin(auth)/admin(pug).pug deleted file mode 100644 index 7da628335..000000000 --- a/templates/app/client/app/admin(auth)/admin(pug).pug +++ /dev/null @@ -1,10 +0,0 @@ -.container - p - | The delete user and user index api routes are restricted to users with the 'admin' role. - ul.list-group - li.list-group-item(ng-repeat='user in admin.users') - strong {{user.name}} - br - span.text-muted {{user.email}} - a.trash(ng-click='admin.delete(user)') - span.glyphicon.glyphicon-trash.pull-right diff --git a/templates/app/client/app/admin(auth)/admin(html).html b/templates/app/client/app/admin(auth)/admin.html similarity index 100% rename from templates/app/client/app/admin(auth)/admin(html).html rename to templates/app/client/app/admin(auth)/admin.html diff --git a/templates/app/client/app/main/main(pug).pug b/templates/app/client/app/main/main(pug).pug deleted file mode 100644 index 9ad5d0ac9..000000000 --- a/templates/app/client/app/main/main(pug).pug +++ /dev/null @@ -1,22 +0,0 @@ -header#banner.hero-unit - .container - h1 'Allo, 'Allo! - p.lead Kick-start your next web app with Angular Fullstack - img(src='assets/images/yeoman.png', alt='I\'m Yeoman') - -.container - .row - .col-lg-12 - h1.page-header Features: - ul.nav.nav-tabs.nav-stacked.col-md-4.col-lg-4.col-sm-6(ng-repeat='thing in awesomeThings') - li - a(href='#', [tooltip]='{{thing.info}}') - | {{thing.name}}<% if (filters.models) { %> - button.close(type='button', (click)='deleteThing(thing)') ×<% } %><% if (filters.socketio) { %> - - form.thing-form - label Syncs in realtime across clients - p.input-group - input.form-control(type='text', placeholder='Add a new thing here.', ng-model='newThing') - span.input-group-btn - button.btn.btn-primary(type='submit', (click)='addThing()') Add New<% } %> diff --git a/templates/app/client/app/main/main(html).html b/templates/app/client/app/main/main.html similarity index 100% rename from templates/app/client/app/main/main(html).html rename to templates/app/client/app/main/main.html diff --git a/templates/app/client/components/footer/footer(pug).pug b/templates/app/client/components/footer/footer(pug).pug deleted file mode 100644 index a4069ea9a..000000000 --- a/templates/app/client/components/footer/footer(pug).pug +++ /dev/null @@ -1,11 +0,0 @@ -.container - p - | Angular Fullstack v<%= rootGeneratorVersion() %> - = ' | ' - a(href='http://angular-fullstack.github.io/generator-angular-fullstack') Documentation - = ' | ' - a(href='https://gitter.im/DaftMonk/generator-angular-fullstack') Chat on Gitter - = ' | ' - a(href='https://github.com/angular-fullstack/generator-angular-fullstack/issues?state=open') Issues - = ' | ' - a(href='https://opencollective.com/angular-fullstack') Donate to our Open Collective diff --git a/templates/app/client/components/footer/footer(html).html b/templates/app/client/components/footer/footer.html similarity index 100% rename from templates/app/client/components/footer/footer(html).html rename to templates/app/client/components/footer/footer.html diff --git a/templates/app/client/components/navbar/navbar(pug).pug b/templates/app/client/components/navbar/navbar(pug).pug deleted file mode 100644 index cd32fb74f..000000000 --- a/templates/app/client/components/navbar/navbar(pug).pug +++ /dev/null @@ -1,34 +0,0 @@ -div.navbar.navbar-default.navbar-static-top - div.container - div.navbar-header - button.navbar-toggle(type='button', ng-click='$ctrl.isCollapsed = !$ctrl.isCollapsed') - span.sr-only Toggle navigation - span.icon-bar - span.icon-bar - span.icon-bar - a.navbar-brand(href='/') <%= lodash.slugify(lodash.humanize(appname)) %> - - div#navbar-main.navbar-collapse.collapse(uib-collapse='$ctrl.isCollapsed') - ul.nav.navbar-nav - li(ng-repeat='item in $ctrl.menu', <% if (filters.uirouter) { %>ui-sref-active='active'<% } else { %>ng-class='{active: $ctrl.isActive(item.link)}'<% } %>) - a(<% if (filters.uirouter) { %>ui-sref='{{item.state}}'<% } else { %>ng-href='{{item.link}}'<% } %>) {{item.title}}<% if (filters.auth) { %> - - li(ng-show='$ctrl.isAdmin()', <% if (filters.uirouter) { %>ui-sref-active='active'<% } else { %>ng-class='{active: $ctrl.isActive("/admin")}'<% } %>) - a(<% if (filters.uirouter) { %>ui-sref='admin'<% } else { %>href='/admin'<% } %>) Admin - - ul.nav.navbar-nav.navbar-right - li(ng-hide='$ctrl.isLoggedIn()', <% if (filters.uirouter) { %>ui-sref-active='active'<% } else { %>ng-class='{active: $ctrl.isActive("/signup")}'<% } %>) - a(<% if (filters.uirouter) { %>ui-sref='signup'<% } else { %>href='/signup'<% } %>) Sign up - - li(ng-hide='$ctrl.isLoggedIn()', <% if (filters.uirouter) { %>ui-sref-active='active'<% } else { %>ng-class='{active: $ctrl.isActive("/login")}'<% } %>) - a(<% if (filters.uirouter) { %>ui-sref='login'<% } else { %>href='/login'<% } %>) Login - - li(ng-show='$ctrl.isLoggedIn()') - p.navbar-text Hello {{ $ctrl.getCurrentUser().name }} - - li(ng-show='$ctrl.isLoggedIn()', <% if (filters.uirouter) { %>ui-sref-active='active'<% } else { %>ng-class='{active: $ctrl.isActive("/settings")}'<% } %>) - a(<% if (filters.uirouter) { %>ui-sref='settings'<% } else { %>href='/settings'<% } %>) - span.glyphicon.glyphicon-cog - - li(ng-show='$ctrl.isLoggedIn()') - a(<% if (filters.uirouter) { %>ui-sref='logout'<% } else { %>href='/logout'<% } %>) Logout<% } %> diff --git a/templates/app/client/components/navbar/navbar(html).html b/templates/app/client/components/navbar/navbar.html similarity index 100% rename from templates/app/client/components/navbar/navbar(html).html rename to templates/app/client/components/navbar/navbar.html diff --git a/templates/app/client/components/oauth-buttons(oauth)/oauth-buttons(pug).pug b/templates/app/client/components/oauth-buttons(oauth)/oauth-buttons(pug).pug deleted file mode 100644 index fd5030bd7..000000000 --- a/templates/app/client/components/oauth-buttons(oauth)/oauth-buttons(pug).pug +++ /dev/null @@ -1,14 +0,0 @@ -<% if(filters.facebookAuth) { %>a.btn<% if (filters.bootstrap) { %>.btn-social<% } %>.btn-facebook(ng-class='classes' - ng-click='OauthButtons.loginOauth("facebook")') - i.fa.fa-facebook - | Connect with Facebook - -<% } if(filters.googleAuth) { %>a.btn<% if (filters.bootstrap) { %>.btn-social<% } %>.btn-google(ng-class='classes' - ng-click='OauthButtons.loginOauth("google")') - i.fa.fa-google-plus - | Connect with Google+ - -<% } if(filters.twitterAuth) { %>a.btn<% if (filters.bootstrap) { %>.btn-social<% } %>.btn-twitter(ng-class='classes' - ng-click='OauthButtons.loginOauth("twitter")') - i.fa.fa-twitter - | Connect with Twitter<% } %> diff --git a/templates/app/client/components/oauth-buttons(oauth)/oauth-buttons(html).html b/templates/app/client/components/oauth-buttons(oauth)/oauth-buttons.html similarity index 100% rename from templates/app/client/components/oauth-buttons(oauth)/oauth-buttons(html).html rename to templates/app/client/components/oauth-buttons(oauth)/oauth-buttons.html diff --git a/templates/app/server/views/404(pug).pug b/templates/app/server/views/404(pug).pug deleted file mode 100644 index b5735b4f6..000000000 --- a/templates/app/server/views/404(pug).pug +++ /dev/null @@ -1,133 +0,0 @@ -doctype html -html(lang='en') -head - meta(charset='utf-8') - title Page Not Found :( - style. - ::-moz-selection { - background: #b3d4fc; - text-shadow: none; - } - ::selection { - background: #b3d4fc; - text-shadow: none; - } - html { - padding: 30px 10px; - font-size: 20px; - line-height: 1.4; - color: #737373; - background: #f0f0f0; - -webkit-text-size-adjust: 100%; - -ms-text-size-adjust: 100%; - } - html, - input { - font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; - } - body { - max-width: 500px; - _width: 500px; - padding: 30px 20px 50px; - border: 1px solid #b3b3b3; - border-radius: 4px; - margin: 0 auto; - box-shadow: 0 1px 10px #a7a7a7, inset 0 1px 0 #fff; - background: #fcfcfc; - } - h1 { - margin: 0 10px; - font-size: 50px; - text-align: center; - } - h1 span { - color: #bbb; - } - h3 { - margin: 1.5em 0 0.5em; - } - p { - margin: 1em 0; - } - ul { - padding: 0 0 0 40px; - margin: 1em 0; - } - .container { - max-width: 380px; - _width: 380px; - margin: 0 auto; - } - /* google search */ - #goog-fixurl ul { - list-style: none; - padding: 0; - margin: 0; - } - #goog-fixurl form { - margin: 0; - } - #goog-wm-qt, - #goog-wm-sb { - border: 1px solid #bbb; - font-size: 16px; - line-height: normal; - vertical-align: top; - color: #444; - border-radius: 2px; - } - #goog-wm-qt { - width: 220px; - height: 20px; - padding: 5px; - margin: 5px 10px 0 0; - box-shadow: inset 0 1px 1px #ccc; - } - #goog-wm-sb { - display: inline-block; - height: 32px; - padding: 0 10px; - margin: 5px 0 0; - white-space: nowrap; - cursor: pointer; - background-color: #f5f5f5; - background-image: -webkit-linear-gradient(rgba(255,255,255,0), #f1f1f1); - background-image: -moz-linear-gradient(rgba(255,255,255,0), #f1f1f1); - background-image: -ms-linear-gradient(rgba(255,255,255,0), #f1f1f1); - background-image: -o-linear-gradient(rgba(255,255,255,0), #f1f1f1); - -webkit-appearance: none; - -moz-appearance: none; - appearance: none; - *overflow: visible; - *display: inline; - *zoom: 1; - } - #goog-wm-sb:hover, - #goog-wm-sb:focus { - border-color: #aaa; - box-shadow: 0 1px 1px rgba(0, 0, 0, 0.1); - background-color: #f8f8f8; - } - #goog-wm-qt:hover, - #goog-wm-qt:focus { - border-color: #105cb6; - outline: 0; - color: #222; - } - input::-moz-focus-inner { - padding: 0; - border: 0; - } - body - .container - h1 - | Not found - span :( - p Sorry, but the page you were trying to view does not exist. - p It looks like this was the result of either: - ul - li a mistyped address - li an out-of-date link - script. - var GOOG_FIXURL_LANG = (navigator.language || '').slice(0,2),GOOG_FIXURL_SITE = location.host; - script(src='//linkhelp.clients.google.com/tbproxy/lh/wm/fixurl.js') diff --git a/templates/app/server/views/404(html).html b/templates/app/server/views/404.html similarity index 100% rename from templates/app/server/views/404(html).html rename to templates/app/server/views/404.html