Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Statix v4 – DO NOT MERGE #6

Open
wants to merge 24 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
7f481b5
Updating SCSS files in line with Kickoff v6
ashleynolan Jan 21, 2016
0e8af89
Updating dependencies to use grunt-assemble (among others), and remov…
ashleynolan Feb 5, 2016
fad55ec
Updating some of the copy and docs, including the Readme
ashleynolan Feb 5, 2016
277b88a
Updating folder structure in Statix – renaming /includes directory to…
ashleynolan Feb 17, 2016
e8d6533
:fire: Getting rid of Grunticon and Photobox
ashleynolan Jul 20, 2016
18f8642
:zap: Updating SCSS and JS files to be inline with Kickoff v7
ashleynolan Jul 20, 2016
b155a90
First commit for restructuring Statix v4 inline with new Kickoff and …
ashleynolan Oct 26, 2016
afde0be
Updating a couple of tasks to compile to correct folder, and fixing p…
ashleynolan Oct 26, 2016
14110d8
Updating package.json with expand and run-sequence package (for expan…
ashleynolan Oct 26, 2016
87910c8
Adding title to the masthead
ashleynolan Oct 26, 2016
9fa8d45
Updating watch tasks so that they can handle when files are added and…
ashleynolan Nov 4, 2016
f7f8a2b
Few typos in config
ashleynolan Jan 27, 2017
1910e9b
Sorting out small indentation issue
ashleynolan Jan 27, 2017
b52ef98
bring Statix in sync with latest from Kickoff
rentorm May 7, 2017
bd1cbf8
update list of dependencies and instructions in readme.md
rentorm May 7, 2017
6d1e74f
add missing SVG and Standalone JS copy tasks
rentorm May 7, 2017
80094ac
add missing svgDir in config
rentorm May 7, 2017
ae20a03
fix main JS file reference in html template
rentorm May 7, 2017
8e53b3b
Merge pull request #7 from rentorm/latest-kickoff
ashleynolan May 10, 2017
2bebc23
Updating generated dist files
ashleynolan May 10, 2017
dab6863
Updated SCSS to align with kickoff v8
ashleynolan May 10, 2017
23077e1
fixes issue with compiled JavaScript not being copied to statix/dist …
rentorm May 10, 2017
b7f50c2
small fix for ‘watch’ task where ‘assemble’ task was triggered on glo…
rentorm May 10, 2017
57b08ab
Merge pull request #10 from rentorm/next
ashleynolan May 11, 2017
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,6 @@ trim_trailing_whitespace = false

[*.yml]
indent_style = space

[*.json]
indent_style = space
3 changes: 3 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
* text=auto

# Don't diff or textually merge source maps
*.map binary
45 changes: 14 additions & 31 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,43 +5,26 @@

# Comment these if we are building js/Sass on the server
assets/dist/**/*
assets/temp/**/*
**/*.map


# CSS & Sass
# css/*.css
.sass-cache/
*.scssc


# Dependencies
# Bower dependencies directory. comment this line to commit them.
bower_modules/*
# Node modules directory. comment this line to commit them.
# - Node modules directory. comment this line to commit them.
node_modules/*
logs
*.log


# Tooling
# Photobox visual regression testing
photobox/
# Generated test files
testing/


# Sublime Text project files
*.sublime-*
# Jekyll compilation directory
_site/


# OS generated files
.DS_Store
.DS_Store?
# OS or Editor folders
._*
.Spotlight-V100
.Trashes
ehthumbs.db
.cache
.DS_Store
.idea
.project
.settings
.tmproj
*.esproj
*.sublime-*
.vscode
nbproject
Thumbs.db
logs
*.log
23 changes: 0 additions & 23 deletions .jshintrc

This file was deleted.

120 changes: 120 additions & 0 deletions .kickoff/config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
/**
* Global build task vars
* Both Webpack and Gulp use these vars. Change as much as you like :)
*/
const pkg = require('../package');
const gutil = require('gulp-util');

const ConfigOptions = function () {
const config = this;

config.srcDir = './assets/src'; // config.srcDir
config.distDir = './assets/dist'; // config.distDir

// CSS-related vars
config.css = {
scssDir: `${config.srcDir}/scss`, // config.css.scssDir
distDir: `${config.distDir}/css`, // config.css.distDir

distFile: 'kickoff', // config.css.distFile
// Renaming this changes the name of the generated CSS file
// Make sure you update your template file

browsers: ['> 5%', 'last 2 versions', 'ie > 8'], // config.css.browsers
// We are supporting the last 2 browsers, any browsers with >5% market share,
// and ensuring we support IE9+ with prefixes
};

// Javascript-related vars
config.js = {
srcDir: `${config.srcDir}/js`, // config.js.srcDir
srcFile: 'script.js', // config.js.srcFile

entryPoints: {
kickoff: [`${this.srcDir}/js/script.js`],
styleguide: [`${this.srcDir}/js/styleguide.js`],

// Create more entry-points by adding to this array, e.g.
// foo: [`${this.srcDir}/js/bar.js`],
},

distDir: `${config.distDir}/js`, // config.js.distDir
distFile: 'kickoff.js', // config.js.distFile
// Renaming this changes the name of the generated JS file
// Make sure you update your template file
};

// Image-related vars
config.img = {
srcDir: `${config.srcDir}/img`, // config.img.srcDir
distDir: `${config.distDir}/img`, // config.img.distDir
};

// SVG-related vars
config.svg = {
srcDir: `${config.srcDir}/svg`, // config.svg.srcDir
distDir: `${config.distDir}/svg`, // config.svg.distDir
};

// Webfont-related vars - unused by default
config.fonts = {
srcDir: `${config.srcDir}/fonts`, // config.fonts.srcDir
distDir: `${config.distDir}/fonts`, // config.fonts.distDir
};

config.gulp = {
// Reports which file was changed
onChange : function(evt) {
gutil.log( gutil.colors.cyan.bold('❯❯ File: ' + evt.path.replace(new RegExp('/.*(?=/' + config.srcDir.substr(2) + ')/'), '')), 'was', gutil.colors.magenta(evt.type) );
},
onError : function (err) {
gutil.beep();
gutil.log();
gutil.log( gutil.colors.red.bold('-----------------------------------------------------------------------') );
gutil.log( gutil.colors.red.bold(err) );

if (gutil.env.prod && err.status === 1) {
process.exit(1);
}

this.emit('end');
}
};

config.statix = {
dir: 'statix', // <%= config.statix.dir%>
srcDir: '/src',
distDir: '/dist',

assetsDir: '/dist/assets',
cssDir: '/css',
jsDir: '/js',
imgDir: '/img',
svgDir: '/svg',
fontsDir: '/fonts',

dataDir: '/data',
helpersDir: '/helpers',
templateDir: '/templates',

isProd: (gutil.env.prod ? true : false)
}

// Banners and info
config.misc = {
banner: `/**
* ██╗ ██╗██╗ ██████╗██╗ ██╗ ██████╗ ███████╗███████╗
* ██║ ██╔╝██║██╔════╝██║ ██╔╝██╔═══██╗██╔════╝██╔════╝
* █████╔╝ ██║██║ █████╔╝ ██║ ██║█████╗ █████╗
* ██╔═██╗ ██║██║ ██╔═██╗ ██║ ██║██╔══╝ ██╔══╝
* ██║ ██╗██║╚██████╗██║ ██╗╚██████╔╝██║ ██║
* ╚═╝ ╚═╝╚═╝ ╚═════╝╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═╝
* ${pkg.title} v${pkg.version}
* ${pkg.homepage}
* ${pkg.repo}
*/
`,
};
};

module.exports = new ConfigOptions();
28 changes: 28 additions & 0 deletions .kickoff/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
/**
* Gulp tasks:
* - gulp : default task. Alias for `gulp compile`
* - gulp compile : compiles js, scss, minifies images etc
* - gulp css : processes scss both for kickoff and styleguide
* - gulp javascript : compile js (using Webpack)
* - gulp serve : run Browsersync server (with hot module reloading)
* - gulp svg : converts SVGs into an SVG sprite-sheet
* - gulp images : minifies images
* - gulp copy : copies files, including standalone js files, to dist folder
* - gulp clean : deletes certain dist directories
* - gulp watch : watches for changes and compile
* - gulp test : various tests. e.g. scss linting
*/

const fs = require('fs');

const tasksDirectory = `${__dirname}/tasks/`;
const tasks = fs.readdirSync(tasksDirectory);

// loop through .kickoff and require each
// any tasks you add will be included automatically
tasks.forEach(task => {
// only add .js files
if (task.match(/\.js$/)) {
require(`${tasksDirectory}/${task}`);
}
});
8 changes: 8 additions & 0 deletions .kickoff/readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Kickoff build configs
> A mixture of gulp, Webpack and Browsersync

## [Config.js](config.js)
This file contains many global build task variables. Modify any of the values to suit your project.

## Tasks
Modify any build task
70 changes: 70 additions & 0 deletions .kickoff/tasks/assemble.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
///////////////////////////////////////////////////////////
// Task Dependencies

const gulp = require('gulp');
const path = require("path");
const debug = require('gulp-debug');
const plumber = require('gulp-plumber');
const config = require('../config');

const assemble = require('assemble');
const expand = require('expand')();
const yaml = require('js-yaml');
const extname = require('gulp-extname');

///////////////////////////////////////////////////////////

const app = assemble();
const statixRoot = config.statix.dir;
const statixRootHelpers = '../../' + config.statix.dir;
const statixSrcDir = statixRoot + config.statix.srcDir;
const statixDistDir = statixRoot + config.statix.distDir;


app.helper('is', require(statixRootHelpers + config.statix.srcDir + config.statix.helpersDir + '/helper-is.js'));
app.helper('exists', require(statixRootHelpers + config.statix.srcDir + config.statix.helpersDir + '/helper-exists.js'));
app.helper('markdown', require('helper-markdown'));
app.helper('md', require('helper-md'));

// to help with parsing yml data files properly
app.dataLoader('yml', function(str, fp) {
return yaml.safeLoad(str);
});

gulp.task('assemble', () => {

//init assemble plugins
app.enable('debugEngine');
app.layouts(statixSrcDir + config.statix.templateDir + '/layouts/*.{md,hbs}');
app.partials(statixSrcDir + config.statix.templateDir + '/partials/**/*.{md,hbs}');
app.data(statixSrcDir + config.statix.dataDir + '/*.{json,yml}');
app.data('./package.json', { namespace: true });
app.option('layout', 'default');

app.data({
baseUrl: (config.statix.isProd ? '' : '')
});

// pre-render any data <%= variable %> declarations in the yml front-end matter
app.preRender(/\.(hbs|html)$/, function (view, next) {
view.data = expand(view.data, app.cache.data);
next();
});

return app.src( statixSrcDir + config.statix.templateDir + '/pages/**/*.{md,hbs}' )
.pipe( plumber( config.gulp.onError ) ) // stops watch from breaking on error
.pipe( debug() )
.pipe( app.renderFile() )
.pipe( extname() )
.pipe( app.dest( statixDistDir ) );

});


gulp.task('assemble:prod', function () {

//ovewrite config vars to act like a production task as that is what is being requested
config.statix.isProd = true;
gulp.start('assemble');

});
35 changes: 35 additions & 0 deletions .kickoff/tasks/clean.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
/**
* gulp clean
*/
const gulp = require('gulp');
const del = require('del');
const config = require('../config');

gulp.task('clean', [/*'clean:images', 'clean:js', 'clean:css', 'clean:svg'*/], () => {
console.log('Cleaning files');
});

// Clean the image directory
gulp.task('clean:images', () => {
return del([config.img.distDir]);
});

// Clean the css directory
gulp.task('clean:css', () => {
return del([`${config.css.distDir}/**/*`]);
});

// Clean the js directory
gulp.task('clean:js', () => {
return del([config.js.distDir]);
});

// Clean the svg directory
gulp.task('clean:svg', () => {
return del([config.svg.distDir]);
});

// Clean the fonts directory
// gulp.task('clean:fonts', () => {
// return del([config.fonts.distDir]);
// });
14 changes: 14 additions & 0 deletions .kickoff/tasks/compile.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
/**
* gulp compile
*/
const gulp = require('gulp');
const config = require('../config');

gulp.task('compile', [
'css',
'javascript',
'images',
'svg',
'copy',
'assemble'
]);
Loading