Permalink
Show file tree
Hide file tree
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
init commit, cannot run gulp tasks yet as I ripped that from another …
…project
- Loading branch information
Josh Fabean
committed
Dec 1, 2017
0 parents
commit e9a47774d73fc9b30e63a588e4216632bdc93f45
Showing
15 changed files
with
7,890 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
@@ -0,0 +1 @@ | ||
node_modules |
This file contains 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
@@ -0,0 +1,33 @@ | ||
/*eslint strict: ["error", "global"]*/ | ||
'use strict'; | ||
|
||
//======================================================= | ||
// Include Our Plugins | ||
//======================================================= | ||
var del = require('del'); | ||
|
||
// Export our tasks. | ||
module.exports = { | ||
|
||
// Clean style guide files. | ||
styleguide: function() { | ||
// You can use multiple globbing patterns as you would with `gulp.src` | ||
return del([ | ||
'./dist/style-guide/*' | ||
], {force: true}); | ||
}, | ||
|
||
// Clean CSS files. | ||
css: function() { | ||
return del([ | ||
'./dist/css/*' | ||
], {force: true}); | ||
}, | ||
|
||
// Clean JS files. | ||
js: function() { | ||
return del([ | ||
'./dist/js/*' | ||
], {force: true}); | ||
} | ||
}; |
This file contains 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
@@ -0,0 +1,70 @@ | ||
/*eslint strict: ["error", "global"]*/ | ||
'use strict'; | ||
|
||
//======================================================= | ||
// Include gulp | ||
//======================================================= | ||
var gulp = require('gulp'); | ||
|
||
//======================================================= | ||
// Include Our Plugins | ||
//======================================================= | ||
var sass = require('gulp-sass'); | ||
var prefix = require('gulp-autoprefixer'); | ||
var sourcemaps = require('gulp-sourcemaps'); | ||
var sync = require('browser-sync'); | ||
var babel = require('gulp-babel'); | ||
var rename = require('gulp-rename'); | ||
|
||
// Small error handler helper function. | ||
function handleError(err) { | ||
console.log(err.toString()); | ||
this.emit('end'); | ||
} | ||
|
||
// Export our tasks. | ||
module.exports = { | ||
|
||
// Compile Sass. | ||
sass: function() { | ||
return gulp.src('./src/{global,layout,components}/**/*.scss') | ||
.pipe( | ||
sass({ outputStyle: 'nested' }) | ||
.on('error', handleError) | ||
) | ||
.pipe(prefix({ | ||
cascade: false | ||
})) | ||
.pipe(rename(function (path) { | ||
path.dirname = ''; | ||
return path; | ||
})) | ||
.pipe(gulp.dest('./dist/css')) | ||
.pipe(sync.stream({match: '**/*.css'})); | ||
}, | ||
|
||
// Compile JavaScript. | ||
js: function() { | ||
return gulp.src([ | ||
'./src/{global,layout,components}/**/*.es6.js' | ||
], { base: './' }) | ||
.pipe(sourcemaps.init()) | ||
.pipe( | ||
babel() | ||
.on('error', handleError) | ||
) | ||
.pipe(rename(function (path) { | ||
// Currently not using ES6 modules so for now | ||
// es6 files are compiled into individual JS files. | ||
// Eventually this can use ES6 Modules and compile | ||
// all files within a component directory into a single | ||
// foo.bundle.js file. In that case the bundle name should | ||
// reflect the components directory name. | ||
path.dirname = ''; | ||
path.basename = path.basename.replace(/\.es6/, ''); | ||
return path; | ||
})) | ||
.pipe(sourcemaps.write('./')) | ||
.pipe(gulp.dest('./dist/js')); | ||
} | ||
}; |
This file contains 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
@@ -0,0 +1,35 @@ | ||
/*eslint strict: ["error", "global"]*/ | ||
'use strict'; | ||
|
||
//======================================================= | ||
// Include gulp | ||
//======================================================= | ||
var gulp = require('gulp'); | ||
|
||
//======================================================= | ||
// Include Our Plugins | ||
//======================================================= | ||
var rename = require('gulp-rename'); | ||
var imagemin = require('gulp-imagemin'); | ||
|
||
// Export our tasks. | ||
module.exports = { | ||
|
||
// Compress svg/png/jpg files. | ||
assets: function() { | ||
return gulp.src([ | ||
'./src/{global,layout,components}/**/*{.png,.jpg,.svg}' | ||
]) | ||
.pipe(imagemin({ | ||
progressive: true, | ||
svgoPlugins: [{ | ||
removeViewBox: false | ||
}] | ||
})) | ||
.pipe(rename(function (path) { | ||
path.dirname = ''; | ||
return path; | ||
})) | ||
.pipe(gulp.dest('./dist/assets')); | ||
} | ||
}; |
This file contains 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
@@ -0,0 +1,42 @@ | ||
/*eslint strict: ["error", "global"]*/ | ||
'use strict'; | ||
|
||
//======================================================= | ||
// Include gulp | ||
//======================================================= | ||
var gulp = require('gulp'); | ||
|
||
//======================================================= | ||
// Include Our Plugins | ||
//======================================================= | ||
var concat = require('gulp-concat'); | ||
var order = require('gulp-order'); | ||
var sync = require('browser-sync'); | ||
|
||
// Export our tasks. | ||
module.exports = { | ||
|
||
// Concat all CSS into a master bundle. | ||
css: function() { | ||
return gulp.src([ | ||
'./dist/css/*.css' | ||
]) | ||
// Reorder the files so global is first. | ||
// If you need to get fancier with the order here's an example: | ||
// .pipe(order([ | ||
// 'dist/css/global.css', | ||
// 'src/components/**/*.css', | ||
// 'dist/css/btn.css', | ||
// 'dist/css/form-item.css', | ||
// 'dist/css/form-float-label.css', | ||
// 'dist/css/*.css' | ||
// ], { base: './' })) | ||
.pipe(order([ | ||
'dist/css/global.css', | ||
'dist/css/*.css' | ||
], { base: './' })) | ||
.pipe(concat('all.css')) | ||
.pipe(gulp.dest('./dist/all')) | ||
.pipe(sync.stream()); | ||
} | ||
}; |
This file contains 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
@@ -0,0 +1,37 @@ | ||
/*eslint strict: ["error", "global"]*/ | ||
'use strict'; | ||
|
||
//======================================================= | ||
// Include gulp | ||
//======================================================= | ||
var gulp = require('gulp'); | ||
|
||
//======================================================= | ||
// Include Our Plugins | ||
//======================================================= | ||
var sassLint = require('gulp-sass-lint'); | ||
var eslint = require('gulp-eslint'); | ||
|
||
// Export our tasks. | ||
module.exports = { | ||
|
||
// Lint Sass based on .sass-lint.yml config. | ||
sass: function() { | ||
return gulp.src([ | ||
'./src/{global,layout,components}/**/*.scss', | ||
'!./src/global/utils/*' | ||
]) | ||
.pipe(sassLint()) | ||
.pipe(sassLint.format()); | ||
}, | ||
|
||
// Lint JavaScript based on .eslintrc config. | ||
js: function() { | ||
return gulp.src([ | ||
'./src/{global,layout,components}/**/*.js', | ||
'!./src/components/**/vendors/*' | ||
]) | ||
.pipe(eslint()) | ||
.pipe(eslint.format()); | ||
} | ||
}; |
This file contains 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
@@ -0,0 +1,33 @@ | ||
/*eslint strict: ["error", "global"]*/ | ||
'use strict'; | ||
|
||
// If some JS components aren't es6 we want to simply move them | ||
// into the dist folder. This allows us to clean the dist/js | ||
// folder on build. | ||
|
||
//======================================================= | ||
// Include gulp | ||
//======================================================= | ||
var gulp = require('gulp'); | ||
|
||
//======================================================= | ||
// Include Our Plugins | ||
//======================================================= | ||
var rename = require('gulp-rename'); | ||
|
||
// Export our tasks. | ||
module.exports = { | ||
|
||
// Moves JavaScript. | ||
js: function() { | ||
return gulp.src([ | ||
'./src/{global,layout,components}/**/*.js', | ||
'!./src/{global,layout,components}/**/*.es6.js' | ||
], { base: './' }) | ||
.pipe(rename(function (path) { | ||
path.dirname = ''; | ||
return path; | ||
})) | ||
.pipe(gulp.dest('./dist/js')); | ||
} | ||
}; |
This file contains 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
@@ -0,0 +1,48 @@ | ||
/*eslint strict: ["error", "global"]*/ | ||
'use strict'; | ||
|
||
//======================================================= | ||
// Include kss | ||
//======================================================= | ||
var kss = require('kss'); | ||
|
||
//======================================================= | ||
// Include Our Plugins | ||
//======================================================= | ||
var path = require('path'); | ||
|
||
// Export our tasks. | ||
module.exports = { | ||
|
||
// Generate the style guide using the top level | ||
// directory name passed in as a parameter. | ||
generate: function(dirname) { | ||
|
||
return kss({ | ||
source: [ | ||
dirname + '/src/global', | ||
dirname + '/src/components', | ||
dirname + '/src/layout' | ||
], | ||
destination: dirname + '/dist/style-guide', | ||
builder: dirname + '/src/style-guide/builder', | ||
namespace: 'centennial:' + dirname + '/src/components/', | ||
'extend-drupal8': true, | ||
// The css and js paths are URLs, like '/misc/jquery.js'. | ||
// The following paths are relative to the generated style guide. | ||
// The all.css file is for the style guide ONLY so you don't have to | ||
// keep adding the file here everytime you add a new component. | ||
// Drupal libraries should be leveraged for adding CSS per component. | ||
css: [ | ||
path.relative( | ||
dirname + '/style-guide/', | ||
dirname + '/all/all.css' | ||
) | ||
], | ||
js: [ | ||
], | ||
homepage: 'style-guide.md', | ||
title: 'Style Guide' | ||
}); | ||
} | ||
}; |
Oops, something went wrong.