Skip to content

Commit 32016ec

Browse files
Dan LaskyShuwen Qian
authored andcommitted
sass build + includes
1 parent f5b8c3a commit 32016ec

3 files changed

Lines changed: 14 additions & 17 deletions

File tree

Gulpfile.js

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,15 @@ var gutil = require('gulp-util');
77
var del = require('del');
88
var sass = require('gulp-sass');
99
var rename = require('gulp-rename');
10+
var merge = require('merge-stream');
1011
var path = require('path');
1112
var vulcanize = require('gulp-vulcanize');
1213
var hogan = require('gulp-hogan');
1314
var debug = require('gulp-debug');
1415
var run = require('run-sequence');
1516
var htmlmin = require('gulp-minify-html');
17+
var wrap = require('gulp-wrap');
18+
var inlineAssets = require('gulp-inline-assets');
1619

1720
var SRC = 'src/';
1821
var BUILD = 'build/';
@@ -29,29 +32,22 @@ gulp.task('copy', function() {
2932
.pipe(gulp.dest(BUILD));
3033
});
3134

32-
3335
gulp.task('sass', function() {
3436
return gulp.src(SRC + 'mm-*/*.scss')
3537
.pipe(sass({includePaths: ['./bower_components/bourbon/app/assets/stylesheets/', './src/shared/sass/']}).on('error', sass.logError))
38+
.pipe(gulp.dest(BUILD))
39+
.pipe(wrap({src:TEMPLATES + "style_module_template.html"},{},{engine:"hogan"}))
40+
.pipe(rename({basename:"style", extname: ".html"}))
3641
.pipe(gulp.dest(BUILD));
3742
});
3843

39-
gulp.task('fontcss', function() {
44+
gulp.task('font', function() {
4045
return gulp.src(SRC + 'shared/fonts/fonts.scss')
4146
.pipe(sass({includePaths: ['./bower_components/bourbon/app/assets/stylesheets/', './src/shared/sass/']}).on('error', sass.logError))
42-
.pipe(gulp.dest(BUILD + 'shared/fonts/'));
43-
});
44-
45-
gulp.task('fontinclude', function() {
46-
47-
var font=fs.readFileSync(BUILD + 'shared/fonts/fonts.css', 'utf8');
48-
return gulp.src(TEMPLATES + 'font_template.html')
49-
.pipe(debug())
50-
.pipe(hogan({style:font}, {}, '.html'))
47+
.pipe(gulp.dest(BUILD + 'shared/fonts/'))
48+
.pipe(wrap("<style><%= contents %></style>"))
5149
.pipe(rename("fonts.html"))
52-
.pipe(debug())
5350
.pipe(gulp.dest(BUILD + '/shared/fonts/'));
54-
5551
});
5652

5753
gulp.task('vulcanize', function() {

grunt/templates/style_module_template.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@
33
* Copyright (c) 2015 MediaMath Inc. All rights reserved.
44
* This code may only be used under the BSD style license found at http://mediamath.github.io/strand/LICENSE.txt
55
-->
6-
<dom-module id="{{module}}-style">
6+
<dom-module id="{{file.path}}-style">
77
<template>
88
<style>
9-
{{{style}}}
9+
{{{contents}}}
1010
</style>
1111
</template>
1212
</dom-module>

package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,14 +41,15 @@
4141
"del": "^2.0.2",
4242
"gulp": "^3.9.0",
4343
"gulp-debug": "^2.1.2",
44-
"gulp-hogan": "^1.2.0",
44+
"gulp-inline-assets": "^0.1.1",
4545
"gulp-minify-html": "^1.0.4",
4646
"gulp-rename": "^1.2.2",
4747
"gulp-sass": "^2.1.0",
4848
"gulp-util": "^3.0.7",
4949
"gulp-vulcanize": "^6.0.1",
5050
"gulp-wrap": "^0.11.0",
51-
"hogan": "^1.0.2",
51+
"hogan.js": "^3.0.2",
52+
"merge-stream": "^1.0.0",
5253
"run-sequence": "^1.1.4"
5354
}
5455
}

0 commit comments

Comments
 (0)