Skip to content

Commit

Permalink
Merge branch 'release/v1.0.1'
Browse files Browse the repository at this point in the history
Conflicts:
	package.json
  • Loading branch information
Gery Hirschfeld committed Aug 28, 2015
2 parents f458285 + 9ba73ca commit 9dc5b9e
Show file tree
Hide file tree
Showing 21 changed files with 201 additions and 78 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
1.0.1 / 2015-08-28
==================

* Updated router
* Added sourcemaps for less and sass
* Added gulp task bootlint and htmllint
* Fixed some typos

1.0.0-rc.23 / 2015-07-24
==================

Expand Down
32 changes: 27 additions & 5 deletions app/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,18 +68,35 @@ var HirschGenerator = yeoman.generators.Base.extend({
prompts.push({
type: 'list',
name: 'cssExtension',
message: 'Do you want to use {LESS} or Sass? ',
choices: ['{LESS}', 'Sass'],
default: '{LESS}'
message: 'Do you want to use {less} or Sass? ',
choices: ['{less}', 'Sass'],
default: '{less}'
});


prompts.push({
type: 'confirm',
name: 'styleSourcemaps',
message: 'Do you want to use sourcemaps for your less/scss file?',
default: true
});

prompts.push({
type: 'confirm',
name: 'autoPrefixr',
message: 'Do you want to automatically generate missing css-prefixes?',
default: true
});


prompts.push({
type: 'confirm',
name: 'useTypescript',
message: 'Do you want to use TypeScript?',
default: false
});


prompts.push({
when: function(props) {
return props.useTypescript;
Expand All @@ -98,9 +115,11 @@ var HirschGenerator = yeoman.generators.Base.extend({
}

this.cssExtension = props.cssExtension;
this.useLess = props.cssExtension === '{LESS}';
this.useLess = props.cssExtension === '{less}';
this.useSass = props.cssExtension === 'Sass';
this.prefix = props.prefix;
this.styleSourcemaps = props.styleSourcemaps;
this.autoPrefixr = props.autoPrefixr;
this.description = props.description;
this.author = props.author;
this.useTypescript = props.useTypescript;
Expand Down Expand Up @@ -185,6 +204,8 @@ var HirschGenerator = yeoman.generators.Base.extend({
this.projectConfig.prompts.author = this.author;
this.projectConfig.prompts.useTypescript = this.useTypescript;
this.projectConfig.prompts.cssExtension = this.cssExtension;
this.projectConfig.prompts.styleSourcemaps = this.styleSourcemaps;
this.projectConfig.prompts.autoPrefixr = this.autoPrefixr;
this.projectConfig.prompts.useLess = this.useLess;
this.projectConfig.prompts.useSass = this.useSass;
this.projectConfig.prompts.typingsPath = this.typingsPath;
Expand Down Expand Up @@ -276,7 +297,7 @@ var HirschGenerator = yeoman.generators.Base.extend({
}else{
this.copyDir(this.projectConfig.path.srcDir, this.projectConfig.path.assets.sassDir);
}

},

testRunnerFiles: function() {
Expand Down Expand Up @@ -342,6 +363,7 @@ var HirschGenerator = yeoman.generators.Base.extend({
},

end: function() {
hirschUtils.hirschPlay();
this.log('');
this.log(hirschUtils.hirschSay());
this.log('Go to your project folder and run ' + chalk.bold.yellow(
Expand Down
11 changes: 8 additions & 3 deletions app/templates/_package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,22 @@
"prefix": "<%= prompts.prefix %>",
"main": "<%= path.distDir %>/<%= path.main %>",
"cssExtension": "<%= prompts.cssExtension %>",
"styleSourcemaps": "<%= prompts.styleSourcemaps %>",
"autoPrefixr": "<%= prompts.autoPrefixr %>",
"language": <% if(prompts.useTypescript) { %>"TypeScript"<% } else { %>"JavaScript"<% } %>,
"private": true,
"dependencies": {},
"devDependencies": {
"gulp": "^3.8.11",
"gulp-concat": "^2.5.2",
"gulp-concat": "^2.5.2",<% if(prompts.autoPrefixr) {%>
"gulp-autoprefixer": "^2.3.1",<% } %>
"gulp-install": "^0.2.0",
"gulp-header": "^1.2.2",
"gulp-htmlmin": "^1.1.1",
"gulp-inject": "^1.2.0",
"gulp-jshint": "^1.11.2",
"gulp-htmllint": "*",
"gulp-bootlint": "*",
"gulp-karma": "0.0.4",<% if (prompts.useLess) { %>
"gulp-less": "^3.0.1",<% } %><% if (prompts.useSass) { %>
"gulp-sass": "*",
Expand All @@ -25,8 +30,8 @@
"gulp-minify-html": "^0.1.7",
"gulp-ng-annotate": "^0.5.2",
"gulp-rename": "^1.2.0",
"gulp-template": "^3.0.0",
"gulp-sourcemaps": "^1.5.2",
"gulp-template": "^3.0.0",<% if(prompts.styleSourcemaps) {%>
"gulp-sourcemaps": "^1.5.2",<% } %>
"gulp-task-listing": "^1.0.0",
"gulp-uglify": "^1.1.0",
"gulp-util": "^3.0.4",
Expand Down
8 changes: 8 additions & 0 deletions app/templates/_project.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,14 @@ module.exports = function (isGenerator) {
'core'
],

/*
See https://github.com/postcss/autoprefixer#browsers for how to use this field
*/
autoprefixer: {
browsers: ['last 2 versions'],
remove: false // Remove unneeded prefixes
},

/**
* PATH
* This object contains all paths
Expand Down
15 changes: 11 additions & 4 deletions app/templates/src/app/core/router/router.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
var Router = function Router() {
this.stack = [];
this.previousState = {};
this.oldPreviousState = {};
};

Router.prototype.use = function (fn) {
Expand All @@ -42,20 +43,25 @@
Router.prototype.addStateChangeListener = function (event, toState, toParams, fromState, fromParams) {
if (this.stack.length > 0 && this.previousState.name !== toState.name) {
event.preventDefault();
var self = this;
this.oldPreviousState = this.previousState;
this.previousState = toState;
this.dispatch(
new AppRouterStart(fromState, fromParams),
new AppRouterDestination(toState, toParams),
function (err) {
function done(err) {
$rootScope.appRouterIsWorking = false;
if (!err) {
$state.go(toState.name);
$state.go(toState.name, toParams || {});
}
},
function abort() {
self.previousState = self.oldPreviousState;
});
}
};

Router.prototype.dispatch = function (start, destination, done) {
Router.prototype.dispatch = function (start, destination, done, abort) {
var idx = 0;
var stack = this.stack;
if (stack.length === 0) {
Expand All @@ -80,7 +86,8 @@
start,
destination,
next,
done
done,
abort
);
} else {
return next();
Expand Down
8 changes: 4 additions & 4 deletions app/templates/src/app/home/views/home.html
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
</pre>
<div class="col-sm-8">
<h1>{{home.title}}</h1>

<p>You just used the hirsch generator to scaffold your new application</p>
</div>
</div>
Expand All @@ -43,7 +44,6 @@ <h1>Generators</h1>
Adds a new constant to your project</p></div>
</div>


<div class="row">
<pre class="col-sm-4" style="font-family: monospace">yo hirsch:view myNewView</pre>
<div class="col-sm-8"><p style="padding-top: 10px;">
Expand Down Expand Up @@ -82,8 +82,7 @@ <h2>Building</h2>
</div>

<div class="row">
<pre class="col-sm-4" style="font-family: monospace">gulp help /*OR*/ gulp list
</pre>
<pre class="col-sm-4" style="font-family: monospace">gulp help /*OR*/ gulp list</pre>
<div class="col-sm-8"><p style="padding-top: 10px;">
Generates new config constant file in your project.</p></div>
</div>
Expand Down Expand Up @@ -157,7 +156,8 @@ <h2>Distribution</h2>
<div class="row">
<pre class="col-sm-4" style="font-family: monospace">gulp dist</pre>
<div class="col-sm-8"><p style="padding-top: 10px;">
This generates a minified app with the production environment(can changed by parameter) into the dist folder</p></div>
This generates a minified app with the production environment(can changed by parameter) into the dist folder</p>
</div>
</div>

</div>
Expand Down
63 changes: 33 additions & 30 deletions app/templates/src/app/layout/directives/header.directive.html
Original file line number Diff line number Diff line change
@@ -1,33 +1,36 @@
<!-- Fixed navbar -->
<nav class="navbar navbar-inverse navbar-fixed-top">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="#">{{ header.title }}</a>
</div>
<div id="navbar" class="navbar-collapse collapse">
<ul class="nav navbar-nav">
<li class="active"><a href="#">Home</a></li>
<li><a href="#about">About</a></li>
<li><a href="#contact">Contact</a></li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false">Dropdown <span class="caret"></span></a>
<ul class="dropdown-menu" role="menu">
<li><a href="#">Action</a></li>
<li><a href="#">Another action</a></li>
<li><a href="#">Something else here</a></li>
<li class="divider"></li>
<li class="dropdown-header">Nav header</li>
<li><a href="#">Separated link</a></li>
<li><a href="#">One more separated link</a></li>
</ul>
</li>
</ul>
</div><!--/.nav-collapse -->
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar"
aria-expanded="false" aria-controls="navbar">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="#">{{ header.title }}</a>
</div>
</nav>
<div id="navbar" class="navbar-collapse collapse">
<ul class="nav navbar-nav">
<li class="active"><a href="#">Home</a></li>
<li><a href="#about">About</a></li>
<li><a href="#contact">Contact</a></li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false">Dropdown <span
class="caret"></span></a>
<ul class="dropdown-menu" role="menu">
<li><a href="#">Action</a></li>
<li><a href="#">Another action</a></li>
<li><a href="#">Something else here</a></li>
<li class="divider"></li>
<li class="dropdown-header">Nav header</li>
<li><a href="#">Separated link</a></li>
<li><a href="#">One more separated link</a></li>
</ul>
</li>
</ul>
</div>
<!--/.nav-collapse -->
</div>
</nav>
4 changes: 2 additions & 2 deletions app/templates/src/app/layout/views/public.html
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
<div class="container-fluid">
<div class="row" ui-view="content"></div>
</div>
<div class="row" ui-view="content"></div>
</div>
16 changes: 16 additions & 0 deletions app/templates/tasks/bootlint.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
'use strict';

var gulp = require('gulp');
var projectConfig = require(process.cwd() + '/project.config.js')();
var bootlint = require('gulp-bootlint');

/**
* Boot-Lint
* Lints all .html files with bootstrap linting rules.
*/
gulp.task('bootlint', function() {
// E001 is DOCTYPE at start of file; E015 is multiple input-addons on one side of input disallowed
// full list here: https://github.com/twbs/bootlint/wiki
return gulp.src(projectConfig.path.srcDir + '/' + projectConfig.path.appDir + '/**/*.html')
.pipe(bootlint({ disabledIds: ['E001', 'E015'] }));
});
2 changes: 1 addition & 1 deletion app/templates/tasks/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ var gulp = require('gulp');
* BUILD
*/

gulp.task('build', [<% if(!prompts.useTypescript) { %>'jshint', <% } %>'inject', 'build-config']);
gulp.task('build', [<% if(!prompts.useTypescript) { %>'jshint', <% } %>'bootlint', 'htmllint', 'inject', 'build-config']);
19 changes: 19 additions & 0 deletions app/templates/tasks/css-auto-prefix.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
'use strict';

var gulp = require('gulp');
var path = require('path');
var projectConfig = require(process.cwd() + '/project.config.js')();
var autoprefixer = require('gulp-autoprefixer');

gulp.task('css-auto-prefix',[<% if(prompts.useLess) { %>'less'<% } %><% if(prompts.useSass) { %>'sass'<% } %><% if(prompts.useTypescript) { %>, 'ts' <% } %>], function () {
var mainCssDir = path.join(projectConfig.path.srcDir, projectConfig.path.assets.cssDir);
var cssFile = projectConfig.pkg.name + '.css';

return gulp.src(path.join(mainCssDir, cssFile))
.pipe(autoprefixer({
browsers: projectConfig.autoprefixer.browsers,
cascade: false,
remove: projectConfig.autoprefixer.remove
}))
.pipe(gulp.dest(mainCssDir));
});
20 changes: 18 additions & 2 deletions app/templates/tasks/css/less.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ var $ = require('gulp-load-plugins')({lazy: true});
var path = require('path');
var browserSync = require('browser-sync');
var reload = browserSync.reload;
var chalk = require('chalk');<% if(prompts.styleSourcemaps) {%>
var sourcemaps = require('gulp-sourcemaps');<% } %><% if(prompts.autoPrefixr) {%>
var autoprefixer = require('gulp-autoprefixer');<% } %>

/**
* LESS
Expand All @@ -19,10 +22,23 @@ gulp.task('less', function () {
var cssFile = projectConfig.pkg.name + '.css';

return gulp
.src(mainLessFile)
.src(mainLessFile)<% if(prompts.styleSourcemaps) {%>
.pipe(sourcemaps.init()) <% } %>
.pipe($.less({
paths: [path.join(__dirname, 'less', 'includes')]
}))
})
.on('error', function (err) {
console.log('');
console.log(chalk.red('X ') + 'LESS - ' + err.message);
console.log('');
this.emit('end');
}))<% if(prompts.autoPrefixr) {%>
.pipe(autoprefixer({
browsers: projectConfig.autoprefixer.browsers,
cascade: false,
remove: projectConfig.autoprefixer.remove
}))<% } %><% if(prompts.styleSourcemaps) {%>
.pipe(sourcemaps.write()) <% } %>
.pipe($.rename(cssFile))
.pipe(gulp.dest(mainCssDir))
.pipe(reload({stream: true}));
Expand Down
Loading

0 comments on commit 9dc5b9e

Please sign in to comment.