Created
November 5, 2016 15:02
-
-
Save marinho/7195c703b8ac6900d85d3ac4adf62384 to your computer and use it in GitHub Desktop.
New gulpfile.js for sc5-stylesheet
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var gulp = require('gulp'); | |
| var styleguide = require('sc5-styleguide'); | |
| var sass = require('gulp-sass'); | |
| const projectTitle = 'C4RE Style Guide'; | |
| const sourcePath = 'src'; | |
| const outputPath = 'output'; | |
| const styleSourcePath = sourcePath + '/styles'; | |
| const scssRoot = styleSourcePath + '/tutorial.scss'; | |
| const scssWild = styleSourcePath + '/**/*.scss'; | |
| const overviewPath = styleSourcePath + '/README.md'; | |
| gulp.task('styleguide:generate', function() { | |
| return gulp.src(scssWild) | |
| .pipe(styleguide.generate({ | |
| title: projectTitle, | |
| server: true, | |
| port: 3001, | |
| rootPath: outputPath, | |
| overviewPath: overviewPath, | |
| beforeBody: [ | |
| "<style>@import url('https://fonts.googleapis.com/css?family=Open+Sans&subset=latin');</style>" | |
| ] | |
| })) | |
| .pipe(gulp.dest(outputPath)); | |
| }); | |
| gulp.task('styleguide:applystyles', function() { | |
| return gulp.src(scssRoot) | |
| .pipe(sass({ errLogToConsole: true })) | |
| .pipe(styleguide.applyStyles()) | |
| .pipe(gulp.dest(outputPath)); | |
| }); | |
| gulp.task('watch', ['styleguide'], function() { | |
| // Start watching changes and update styleguide whenever changes are detected | |
| // Styleguide automatically detects existing server instance | |
| gulp.watch(['*.scss'], ['styleguide']); | |
| }); | |
| gulp.task('styleguide', ['styleguide:generate', 'styleguide:applystyles']); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment