Skip to content
Permalink
Browse files

init commit, cannot run gulp tasks yet as I ripped that from another …

…project
  • Loading branch information...
fabean committed Dec 1, 2017
0 parents commit e9a47774d73fc9b30e63a588e4216632bdc93f45
Showing with 7,890 additions and 0 deletions.
  1. +1 −0 .gitignore
  2. +33 −0 gulp-tasks/clean.js
  3. +70 −0 gulp-tasks/compile.js
  4. +35 −0 gulp-tasks/compress.js
  5. +42 −0 gulp-tasks/concat.js
  6. +37 −0 gulp-tasks/lint.js
  7. +33 −0 gulp-tasks/move.js
  8. +48 −0 gulp-tasks/styleguide.js
  9. +173 −0 gulpfile.js
  10. +13 −0 package-lock.json
  11. +47 −0 package.json
  12. +1,497 −0 src/_grid.scss
  13. +7 −0 src/_variables.scss
  14. +5 −0 src/flexbox-grid.scss
  15. +5,849 −0 yarn.lock
@@ -0,0 +1 @@
node_modules
@@ -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});
}
};
@@ -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'));
}
};
@@ -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'));
}
};
@@ -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());
}
};
@@ -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());
}
};
@@ -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'));
}
};
@@ -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'
});
}
};

0 comments on commit e9a4777

Please sign in to comment.
You can’t perform that action at this time.