diff --git a/Gruntfile.js b/Gruntfile.js index 619b7ae..23daad9 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -453,6 +453,27 @@ module.exports = function(grunt) { } }, + // Styleguide + + assemble: { + options: { + assets: '../', + layoutdir: 'src/styleguide/layouts', + layout: 'default.hbs', + partials: ['src/styleguide/blocks/**/*.hbs'], + helpers: [ + 'handlebars-helper-compose', + 'src/styleguide/helpers/**/*.js' + ], + flatten: true + }, + styleguide: { + files: [{ + 'dist/styleguide/': ['src/styleguide/*.hbs'] + }] + } + }, + // Development connect: { @@ -610,6 +631,7 @@ module.exports = function(grunt) { grunt.loadNpmTasks('grunt-svgstore'); grunt.loadNpmTasks('grunt-shell'); grunt.loadNpmTasks('grunt-angular-templates'); + grunt.loadNpmTasks('assemble'); // Build tasks grunt.registerTask('dist-css', ['sass', 'autoprefixer', 'csso']); diff --git a/package.json b/package.json index 980dbd7..f4e9d60 100644 --- a/package.json +++ b/package.json @@ -74,6 +74,8 @@ "sinon": "~1.7.3", "tcp-socket": "~0.5.0", "time-grunt": "^1.0.0", - "wo-smtpclient": "~0.6.0" + "wo-smtpclient": "~0.6.0", + "assemble": "~0.4.42", + "handlebars-helper-compose": "~0.2.12" } } diff --git a/src/styleguide/helpers/strip-file-extension.js b/src/styleguide/helpers/strip-file-extension.js new file mode 100644 index 0000000..5bef48b --- /dev/null +++ b/src/styleguide/helpers/strip-file-extension.js @@ -0,0 +1,11 @@ +'use strict'; + +module.exports.register = function(Handlebars) { + + // Customize this helper + Handlebars.registerHelper('stripFileExtension', function(str) { + var content = str.replace(/\.[^\.]*$/, ''); + return new Handlebars.SafeString(content); + }); + +}; \ No newline at end of file diff --git a/src/styleguide/index.hbs b/src/styleguide/index.hbs new file mode 100644 index 0000000..2ba0250 --- /dev/null +++ b/src/styleguide/index.hbs @@ -0,0 +1,8 @@ +--- +title: Styleguide +--- + +{{#compose src="src/img/icons/*.svg"}} + + {{@filename}} +{{/compose}} \ No newline at end of file diff --git a/src/styleguide/layouts/default.hbs b/src/styleguide/layouts/default.hbs new file mode 100644 index 0000000..eb3e934 --- /dev/null +++ b/src/styleguide/layouts/default.hbs @@ -0,0 +1,19 @@ + + + + + {{ title }} | Whiteout Mail + + + + + + +
+ {{glob "src/img/icons/all.svg"}} +
+ + {{> body}} + + + \ No newline at end of file