Skip to content

Commit

Permalink
Initialize falkorn-theme-docs
Browse files Browse the repository at this point in the history
  • Loading branch information
ukathemes committed Aug 12, 2020
0 parents commit d86eb40
Show file tree
Hide file tree
Showing 24 changed files with 11,157 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# ignore node dependency directories
node_modules/
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Falkorn Theme Documentation
Documentation for our Falkorn WordPress Theme.
28 changes: 28 additions & 0 deletions build.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
'use strict';
/**
* Inline and compress html file.
*
* Compiles:
* build/index.html
*
* @command npm build
*/
var inline = require('inline-source'),
fs = require('filendir'),
path = require('path') ,
src = 'src/index.html',
build = 'build/index.html';

inline(src, {
compress: true,
attribute: false,
svgAsImage: true,
rootpath: path.dirname(src),
ignore: ['script']
}, function (err, html) {
if (!err) {
fs.writeFileSync(build, html);
} else {
throw err;
}
});
342 changes: 342 additions & 0 deletions build/index.html

Large diffs are not rendered by default.

9 changes: 9 additions & 0 deletions gulpfile.js/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"baseDir" : "src",

"stylesSrc" : "./src/sass",
"stylesDest" : "./src/css",

"imagesSrc" : "./src/images/src",
"imagesDest" : "./src/images"
}
18 changes: 18 additions & 0 deletions gulpfile.js/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
'use strict';
/**
* Gulpfile Home
* @see gulpfile.js/tasks
*
* @command npm install
* @command gulp watch
*
* @command gulp all
* @command gulp styles
* @command gulp images
*/
const gulp = require( 'gulp' );
const requireDir = require( 'require-dir' );
const forwardRef = require( 'undertaker-forward-reference' );

gulp.registry( forwardRef() );
requireDir( './tasks', { extensions: ['.js'] } );
43 changes: 43 additions & 0 deletions gulpfile.js/tasks/default.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
'use strict';
/**
* Default Task Commands
*
* @command gulp all
* @command gulp watch
*/
const gulp = require( 'gulp' );
const browserSync = require( 'browser-sync' );
const config = require( '../config.json' );

const browsersync = done => {
browserSync.init({
server: { baseDir: config.baseDir + '/' },
open: false,
notify: false,
injectChanges: true,
online: true,
watchEvents: [ 'change', 'add', 'unlink', 'addDir', 'unlinkDir' ]
});
done();
};

const browserReload = done => {
browserSync.reload();
done();
};


/**
* Run All Builder Tasks
*/
gulp.task( 'all', gulp.series( 'styles', 'images' ) );


/**
* Watch For File Changes & Run Tasks
*/
gulp.task( 'watch', gulp.series( 'styles', 'images', browsersync, () => {
gulp.watch( [config.stylesSrc + '/*.scss', config.stylesSrc + '/**/*.scss'], gulp.series( 'styles' ) )
gulp.watch( config.imagesSrc + '/*{.jpg,.gif,.png,.svg}', gulp.series( 'images' ) )
gulp.watch( config.baseDir + '/*.html', gulp.series( browserReload ) )
}));
36 changes: 36 additions & 0 deletions gulpfile.js/tasks/images.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
'use strict';
/**
* Minify Images (png, jpeg, gif, svg)
*
* Compiles:
* images/*.(png, jpeg, gif, svg)
*
* @command gulp images
*/
const gulp = require( 'gulp' );
const newer = require( 'gulp-newer' );
const imagemin = require( 'gulp-imagemin' );
const notify = require( 'gulp-notify' );
const config = require( '../config.json' );


/**
* Minify Images
*/
gulp.task( 'images', () => {
return gulp
.src( config.imagesSrc + '/*{.jpg,.gif,.png,.svg}' )
.pipe( newer( config.imagesDest ) )
.pipe(
imagemin([
imagemin.gifsicle({ interlaced: true }),
imagemin.jpegtran({ progressive: true }),
imagemin.optipng({ optimizationLevel: 3 }), // 0-7 low-high
imagemin.svgo({
plugins: [ { removeViewBox: true }, { cleanupIDs: false } ]
})
])
)
.pipe( gulp.dest( config.imagesDest ) )
.pipe( notify({ message: '\n\n✅ ===> IMAGES — completed!\n', onLast: true }) )
});
6 changes: 6 additions & 0 deletions gulpfile.js/tasks/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
'use strict';
/**
* Make an index.js in a directory with this code to clean things up:
* @source https://github.com/aseemk/requireDir
*/
module.exports = require('require-dir')(); // defaults to '.'
65 changes: 65 additions & 0 deletions gulpfile.js/tasks/styles.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
'use strict';
/**
* Theme Styles
*
* Compiles:
* css/style.css
*
* @command gulp styles
*/
const gulp = require( 'gulp' );
const sass = require( 'gulp-sass' );
const browserSync = require( 'browser-sync' );
const autoprefixer = require( 'gulp-autoprefixer' );
const lineec = require( 'gulp-line-ending-corrector' );
const plumber = require( 'gulp-plumber' );
const beep = require( 'beepbeep' );
const notify = require( 'gulp-notify' );
const config = require( '../config.json' );

const autoprefixers = [
'last 2 version',
'> 1%',
'ie >= 11',
'last 1 Android versions',
'last 1 ChromeAndroid versions',
'last 2 Chrome versions',
'last 2 Firefox versions',
'last 2 Safari versions',
'last 2 iOS versions',
'last 2 Edge versions',
'last 2 Opera versions'
];


/**
* Custom Error Handler.
*
* @param Mixed err
*/
const errorHandler = r => {
notify.onError( '\n\n❌ ===> ERROR: <%= error.message %>\n' )( r );
beep();
};


/**
* Create style.css
*/
gulp.task( 'styles', () => {
return gulp
.src( config.stylesSrc + '/*.scss', { allowEmpty: true } )
.pipe( plumber( errorHandler ) )
.pipe(
sass({
errLogToConsole: true,
outputStyle: 'expanded',
precision: 5
})
)
.on( 'error', sass.logError )
.pipe( autoprefixer( autoprefixers ) )
.pipe( lineec() )
.pipe( gulp.dest( config.stylesDest ) )
.pipe( browserSync.stream() )
});
Loading

0 comments on commit d86eb40

Please sign in to comment.