diff --git a/Gulpfile.js b/Gulpfile.js index b636fdba..b720ce58 100644 --- a/Gulpfile.js +++ b/Gulpfile.js @@ -16,26 +16,35 @@ var run = require('run-sequence'); var htmlmin = require('gulp-minify-html'); var wrap = require('gulp-wrap'); var inlineAssets = require('gulp-inline-assets'); +var marked = require('gulp-marked'); +var changed = require('gulp-changed'); +var es = require('event-stream'); +var cache = require('gulp-cached'); var SRC = 'src/'; var BUILD = 'build/'; -var DOCS = 'build_docs/'; +var BUILD_DOCS = 'build_docs/'; var DIST = 'dist/'; var TEMPLATES = 'grunt/templates/'; //TODO swap to gulp /** BUILD **/ gulp.task('clean', function() { - return del(BUILD, DOCS, DIST); + return del([BUILD + '**', BUILD_DOCS+ '**', DIST+ '**']); }); gulp.task('copy', function() { return gulp.src([SRC + '**/*.+(html|js|woff)', '!' + SRC +'**/example.html']) + .pipe(changed(BUILD)) + .pipe(debug()) .pipe(gulp.dest(BUILD)); }); gulp.task('sass', function() { return gulp.src(SRC + 'mm-*/*.scss') + // .pipe(cache()) + .pipe(changed(BUILD, {extension:'.css'})) + .pipe(debug()) .pipe(sass({includePaths: ['./bower_components/bourbon/app/assets/stylesheets/', './src/shared/sass/']}).on('error', sass.logError)) .pipe(gulp.dest(BUILD)) .pipe(wrap({src:TEMPLATES + "style_module_template.html"},{},{engine:"hogan"})) @@ -54,6 +63,7 @@ gulp.task('font', function() { gulp.task('vulcanize', function() { var modules = gulp.src(BUILD + "mm-*/mm-*.html") + .pipe(changed(BUILD)) .pipe(vulcanize({ inlineScripts:true, inlineCss:true, @@ -85,6 +95,10 @@ gulp.task('default', function(cb) { run('clean','copy',['sass','font'],'vulcanize',cb); }); +gulp.task('build', function(cb) { + run('copy', ['sass','font'],'vulcanize', cb); +}); + gulp.task('vulcanize:prod', function() { return gulp.src(BUILD + "mm-*/mm-*.html") .pipe(vulcanize({ @@ -104,12 +118,23 @@ gulp.task('vulcanize:prod', function() { gulp.task('docs', function() { var modules = glob.sync("mm-*", {cwd:SRC}); + var articles = glob.sync("*.md", {cwd:"./docs/articles/"}); + var articleMap = JSON.parse(fs.readFileSync('./docs/articles/manifest.json')); + + var articleStream = gulp.src('./docs/articles/*.md') + .pipe(debug()) + .pipe(marked().on('error',console.log)) + .pipe(wrap({src:"./docs/article_template.html"},{},{engine:"hogan"}).on('error',console.log)) + .pipe(gulp.dest(BUILD_DOCS)); + return articles; }); /** LIVE **/ -gulp.task('sass:watch', function () { - gulp.watch('./sass/**/*.scss', ['sass']); +gulp.task('watch', function () { + gulp.watch(SRC + 'mm-*/*.scss', ['sass']); + // gulp.watch(SRC) + // gulp.watch('./') }); /** DEPLOY **/ \ No newline at end of file diff --git a/docs/article_template.html b/docs/article_template.html index 731dec5e..62d0c83b 100644 --- a/docs/article_template.html +++ b/docs/article_template.html @@ -7,7 +7,7 @@ {{> footer}}
- {{{article}}} + {{{contents}}}
diff --git a/package.json b/package.json index 24de67a3..c5038f1d 100644 --- a/package.json +++ b/package.json @@ -12,9 +12,11 @@ "Justin Moore ", "Derek Olson " ], - "license": "BSD", + "license": "BSD-3-Clause", "devDependencies": { - "autoprefixer": "^6.0.3", + "del": "^2.0.2", + "event-stream": "^3.3.2", + "glob": "^5.0.15", "grunt": "*", "grunt-banner": "^0.3.1", "grunt-bump": "^0.3.0", @@ -33,13 +35,12 @@ "grunt-shell": "^1.1.2", "grunt-text-replace": "^0.4.0", "grunt-vulcanize": "^1.0.0", - "load-grunt-tasks": "*", - "marked": "^0.3.3", - "time-grunt": "^1.2.1", - "del": "^2.0.2", "gulp": "^3.9.0", + "gulp-cached": "^1.1.0", + "gulp-changed": "^1.3.0", "gulp-debug": "^2.1.2", "gulp-inline-assets": "^0.1.1", + "gulp-marked": "^1.0.0", "gulp-minify-html": "^1.0.4", "gulp-rename": "^1.2.2", "gulp-sass": "^2.1.0", @@ -47,8 +48,10 @@ "gulp-vulcanize": "^6.0.1", "gulp-wrap": "^0.11.0", "hogan.js": "^3.0.2", + "load-grunt-tasks": "*", + "marked": "^0.3.3", "merge-stream": "^1.0.0", "run-sequence": "^1.1.4", - "glob": "^5.0.15" + "time-grunt": "^1.2.1" } }