add asentus template
This commit is contained in:
107
web/construction/asentus/dev-tools/gulpfile.js
Normal file
107
web/construction/asentus/dev-tools/gulpfile.js
Normal file
@@ -0,0 +1,107 @@
|
||||
// --------------------------------------------------
|
||||
// [Gulpfile]
|
||||
// --------------------------------------------------
|
||||
|
||||
'use strict';
|
||||
|
||||
var gulp = require('gulp'),
|
||||
sass = require('gulp-sass'),
|
||||
changed = require('gulp-changed'),
|
||||
cleanCSS = require('gulp-clean-css'),
|
||||
rtlcss = require('gulp-rtlcss'),
|
||||
rename = require('gulp-rename'),
|
||||
uglify = require('gulp-uglify'),
|
||||
pump = require('pump'),
|
||||
htmlhint = require('gulp-htmlhint');
|
||||
|
||||
|
||||
// Gulp plumber error handler
|
||||
function errorLog(error) {
|
||||
console.error.bind(error);
|
||||
this.emit('end');
|
||||
}
|
||||
|
||||
|
||||
// --------------------------------------------------
|
||||
// [Libraries]
|
||||
// --------------------------------------------------
|
||||
|
||||
// Sass - Compile Sass files into CSS
|
||||
gulp.task('sass', function () {
|
||||
gulp.src('../HTML/sass/**/*.scss')
|
||||
.pipe(changed('../HTML/css/'))
|
||||
.pipe(sass({ outputStyle: 'expanded' }))
|
||||
.on('error', sass.logError)
|
||||
.pipe(gulp.dest('../HTML/css/'));
|
||||
});
|
||||
|
||||
|
||||
// Minify CSS
|
||||
gulp.task('minify-css', function() {
|
||||
// Theme
|
||||
gulp.src(['../HTML/css/layout.css', '!../HTML/css/layout.min.css'])
|
||||
.pipe(cleanCSS({debug: true}, function(details) {
|
||||
console.log(details.name + ': ' + details.stats.originalSize);
|
||||
console.log(details.name + ': ' + details.stats.minifiedSize);
|
||||
}))
|
||||
.pipe(rename({suffix: '.min'}))
|
||||
.pipe(gulp.dest('../HTML/css/'));
|
||||
|
||||
// RTL
|
||||
gulp.src(['../HTML/css/layout-rtl.css', '!../HTML/css/layout-rtl.min.css'])
|
||||
.pipe(cleanCSS({debug: true}, function(details) {
|
||||
console.log(details.name + ': ' + details.stats.originalSize);
|
||||
console.log(details.name + ': ' + details.stats.minifiedSize);
|
||||
}))
|
||||
.pipe(rename({suffix: '.min'}))
|
||||
.pipe(gulp.dest('../HTML/css/'));
|
||||
});
|
||||
|
||||
|
||||
// RTL CSS - Convert LTR CSS to RTL.
|
||||
gulp.task('rtlcss', function () {
|
||||
gulp.src(['../HTML/css/layout.css', '!../HTML/css/layout.min.css', '!../HTML/css/layout-rtl.css', '!../HTML/css/layout-rtl.min.css'])
|
||||
.pipe(changed('../HTML/css/'))
|
||||
.pipe(rtlcss())
|
||||
.pipe(rename({ suffix: '-rtl' }))
|
||||
.pipe(gulp.dest('../HTML/css/'));
|
||||
});
|
||||
|
||||
|
||||
// Minify JS - Minifies JS
|
||||
gulp.task('uglify', function (cb) {
|
||||
pump([
|
||||
gulp.src(['../HTML/js/**/*.js', '!../HTML/js/**/*.min.js']),
|
||||
uglify(),
|
||||
rename({ suffix: '.min' }),
|
||||
gulp.dest('../HTML/js/')
|
||||
],
|
||||
cb
|
||||
);
|
||||
});
|
||||
|
||||
|
||||
// Htmlhint - Validate HTML
|
||||
gulp.task('htmlhint', function() {
|
||||
gulp.src('../HTML/*.html')
|
||||
.pipe(htmlhint())
|
||||
.pipe(htmlhint.reporter())
|
||||
.pipe(htmlhint.failReporter({ suppress: true }))
|
||||
});
|
||||
|
||||
|
||||
// --------------------------------------------------
|
||||
// [Gulp Task - Watch]
|
||||
// --------------------------------------------------
|
||||
|
||||
// Lets us type "gulp" on the command line and run all of our tasks
|
||||
gulp.task('default', ['sass', 'minify-css', 'rtlcss', 'uglify', 'htmlhint', 'watch']);
|
||||
|
||||
// This handles watching and running tasks
|
||||
gulp.task('watch', function () {
|
||||
gulp.watch('../HTML/sass/**/*.scss', ['sass']);
|
||||
gulp.watch('../HTML/css/layout.css', ['minify-css']);
|
||||
gulp.watch('../HTML/css/layout.css', ['rtlcss']);
|
||||
gulp.watch('../HTML/js/**/*.js', ['uglify']);
|
||||
gulp.watch('../HTML/*.html', ['htmlhint']);
|
||||
});
|
||||
63
web/construction/asentus/dev-tools/index.js
Normal file
63
web/construction/asentus/dev-tools/index.js
Normal file
@@ -0,0 +1,63 @@
|
||||
'use strict';
|
||||
|
||||
var util = require('util');
|
||||
var Orchestrator = require('orchestrator');
|
||||
var gutil = require('gulp-util');
|
||||
var deprecated = require('deprecated');
|
||||
var vfs = require('vinyl-fs');
|
||||
|
||||
function Gulp() {
|
||||
Orchestrator.call(this);
|
||||
}
|
||||
util.inherits(Gulp, Orchestrator);
|
||||
|
||||
Gulp.prototype.task = Gulp.prototype.add;
|
||||
Gulp.prototype.run = function() {
|
||||
// `run()` is deprecated as of 3.5 and will be removed in 4.0
|
||||
// Use task dependencies instead
|
||||
|
||||
// Impose our opinion of "default" tasks onto orchestrator
|
||||
var tasks = arguments.length ? arguments : ['default'];
|
||||
|
||||
this.start.apply(this, tasks);
|
||||
};
|
||||
|
||||
Gulp.prototype.src = vfs.src;
|
||||
Gulp.prototype.dest = vfs.dest;
|
||||
Gulp.prototype.watch = function(glob, opt, fn) {
|
||||
if (typeof opt === 'function' || Array.isArray(opt)) {
|
||||
fn = opt;
|
||||
opt = null;
|
||||
}
|
||||
|
||||
// Array of tasks given
|
||||
if (Array.isArray(fn)) {
|
||||
return vfs.watch(glob, opt, function() {
|
||||
this.start.apply(this, fn);
|
||||
}.bind(this));
|
||||
}
|
||||
|
||||
return vfs.watch(glob, opt, fn);
|
||||
};
|
||||
|
||||
// Let people use this class from our instance
|
||||
Gulp.prototype.Gulp = Gulp;
|
||||
|
||||
// Deprecations
|
||||
deprecated.field('gulp.env has been deprecated. ' +
|
||||
'Use your own CLI parser instead. ' +
|
||||
'We recommend using yargs or minimist.',
|
||||
console.warn,
|
||||
Gulp.prototype,
|
||||
'env',
|
||||
gutil.env
|
||||
);
|
||||
|
||||
Gulp.prototype.run = deprecated.method('gulp.run() has been deprecated. ' +
|
||||
'Use task dependencies or gulp.watch task triggering instead.',
|
||||
console.warn,
|
||||
Gulp.prototype.run
|
||||
);
|
||||
|
||||
var inst = new Gulp();
|
||||
module.exports = inst;
|
||||
21
web/construction/asentus/dev-tools/package.json
Normal file
21
web/construction/asentus/dev-tools/package.json
Normal file
@@ -0,0 +1,21 @@
|
||||
{
|
||||
"name": "acidus",
|
||||
"version": "1.0.0",
|
||||
"description": "HTML5 Template",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
"test": "echo \"Error: no test specified\" && exit 1"
|
||||
},
|
||||
"author": "keenthemes.com",
|
||||
"license": "ISC",
|
||||
"devDependencies": {
|
||||
"gulp": "^3.9.1",
|
||||
"gulp-changed": "^1.3.0",
|
||||
"gulp-clean-css": "^2.0.10",
|
||||
"gulp-htmlhint": "^0.3.1",
|
||||
"gulp-rename": "^1.2.2",
|
||||
"gulp-rtlcss": "^1.0.0",
|
||||
"gulp-sass": "^2.3.2",
|
||||
"gulp-uglify": "^1.5.4"
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user