Commit 6a6dd068 authored by Raimo Reiman's avatar Raimo Reiman
Browse files

Update

parent c7dc660c
{
"assets": {
"location": "./src/assets/**/*",
"destination": "./dist/assets/",
"images": "./src/assets/images/**/*",
"imagesLocation": "/src/assets/images/"
},
"browsers": [
"last 2 Chrome versions",
"last 2 Firefox versions",
"last 2 Safari versions",
"last 2 Edge versions",
"IE >= 11"
],
"html": {
"location": "./src/html/**/*.html",
"destination": "./dist/",
"partials": "./src/html/partials/**/*.html",
"partialsLocation": "./src/html/partials/",
"lintConfig": ".htmlhintrc"
},
"js": {
"location": "./src/js/**/*.js",
"destination": "./dist/js/",
"externalFiles": [
"./node_modules/jquery/dist/jquery.js",
"./node_modules/popper.js/dist/umd/popper.js",
"./node_modules/bootstrap/dist/js/bootstrap.js",
"./node_modules/autosize/dist/autosize.js",
"./node_modules/webui-popover/src/jquery.webui-popover.js",
"./node_modules/tooltip.js/dist/umd/tooltip.js"
]
},
"scss": {
"location": "./src/scss/**/*.scss",
"destination": "./dist/css/",
"externalFiles": [
"./node_modules/bootstrap/scss/"
],
"lintConfig": ".sass-lint.yml"
},
"settings": {
"favicon": "./dist/assets/mta_visuaal.ico",
"name": "mta_visuaal",
"destination": "./dist/"
}
{
"assets": {
"location": "./src/assets/**/*",
"destination": "./dist/assets/",
"images": "./src/assets/images/**/*",
"imagesLocation": "/src/assets/images/"
},
"browsers": [
"last 2 Chrome versions",
"last 2 Firefox versions",
"last 2 Safari versions",
"last 2 Edge versions",
"IE >= 11"
],
"html": {
"location": "./src/html/**/*.html",
"destination": "./dist/",
"partials": "./src/html/partials/**/*.html",
"partialsLocation": "./src/html/partials/",
"lintConfig": ".htmlhintrc"
},
"js": {
"location": "./src/js/**/*.js",
"destination": "./dist/js/",
"externalFiles": [
"./node_modules/jquery/dist/jquery.js",
"./node_modules/popper.js/dist/umd/popper.js",
"./node_modules/bootstrap/dist/js/bootstrap.js",
"./node_modules/autosize/dist/autosize.js",
"./node_modules/webui-popover/src/jquery.webui-popover.js",
"./node_modules/tooltip.js/dist/umd/tooltip.js"
]
},
"scss": {
"location": "./src/scss/**/*.scss",
"destination": "./dist/css/",
"externalFiles": [
"./node_modules/bootstrap/scss/"
],
"lintConfig": ".sass-lint.yml"
},
"settings": {
"favicon": "./dist/assets/favicon.ico",
"name": "main",
"destination": "./dist/"
}
}
\ No newline at end of file
var gulp = require('gulp');
var requireDir = require('require-dir'),
runSequence = require('run-sequence');
requireDir('linters');
gulp.task('default', function () {
runSequence(
['sass', 'scripts', 'copy-assets'],
'file-include',
['web-server', 'watch'],
['html-lint', 'sass-lint']);
var gulp = require('gulp');
var requireDir = require('require-dir'),
runSequence = require('run-sequence');
requireDir('linters');
gulp.task('default', function () {
runSequence(
['sass', 'scripts', 'copy-assets'],
'file-include',
['web-server', 'watch'],
['html-lint', 'sass-lint']);
});
\ No newline at end of file
var gulp = require('gulp');
var config = require('../../config.json');
var gutil = require('gulp-util'),
htmlhint = require('gulp-htmlhint');
gulp.task('html-lint', function () {
gulp.src(config.html.location)
.pipe(htmlhint(config.html.lintConfig))
.pipe(htmlhint.reporter());
var gulp = require('gulp');
var config = require('../../config.json');
var gutil = require('gulp-util'),
htmlhint = require('gulp-htmlhint');
gulp.task('html-lint', function () {
gulp.src(config.html.location)
.pipe(htmlhint(config.html.lintConfig))
.pipe(htmlhint.reporter());
});
\ No newline at end of file
var gulp = require('gulp');
var config = require('../../config.json');
var eslint = require('gulp-eslint');
gulp.task('js-lint', function () {
return gulp.src(config.js.location)
.pipe(eslint())
.pipe(eslint.format())
.pipe(eslint.failAfterError());
var gulp = require('gulp');
var config = require('../../config.json');
var eslint = require('gulp-eslint');
gulp.task('js-lint', function () {
return gulp.src(config.js.location)
.pipe(eslint())
.pipe(eslint.format())
.pipe(eslint.failAfterError());
});
\ No newline at end of file
var gulp = require('gulp');
var config = require('../../config.json');
var fs = require('fs'),
sassLint = require('gulp-sass-lint');
gulp.task('sass-lint', function () {
return gulp.src(config.scss.location)
.pipe(sassLint({
configFile: config.scss.lintConfig
}))
.pipe(sassLint.format())
.pipe(sassLint.failOnError())
});
/*gulp.task('sass-lint', function () {
var file = fs.createWriteStream('.sass-lint-result.txt');
var stream = gulp.src(config.scss.location)
.pipe(sassLint({
options: {
configFile: config.scss.lintConfig,
formatter: 'compact'
}
}))
.pipe(sassLint.format(file));
stream.on('finish', function() {
file.end();
});
return stream;
var gulp = require('gulp');
var config = require('../../config.json');
var fs = require('fs'),
sassLint = require('gulp-sass-lint');
gulp.task('sass-lint', function () {
return gulp.src(config.scss.location)
.pipe(sassLint({
configFile: config.scss.lintConfig
}))
.pipe(sassLint.format())
.pipe(sassLint.failOnError())
});
/*gulp.task('sass-lint', function () {
var file = fs.createWriteStream('.sass-lint-result.txt');
var stream = gulp.src(config.scss.location)
.pipe(sassLint({
options: {
configFile: config.scss.lintConfig,
formatter: 'compact'
}
}))
.pipe(sassLint.format(file));
stream.on('finish', function() {
file.end();
});
return stream;
});*/
\ No newline at end of file
var gulp = require('gulp');
var config = require('../config.json');
var autoprefixer = require('gulp-autoprefixer'),
sass = require('gulp-sass'),
sassUnicode = require('gulp-sass-unicode'),
sourcemaps = require('gulp-sourcemaps');
sass.compiler = require('node-sass');
gulp.task('sass', function () {
return gulp.src(config.scss.location)
.pipe(sass({
includePaths: [
config.scss.externalFiles
],
sourcemap: true
}).on('error', sass.logError))
.pipe(sassUnicode())
.pipe(autoprefixer({
browsers: config.browsers
}))
.pipe(sourcemaps.write(''))
.pipe(gulp.dest(config.scss.destination));
var gulp = require('gulp');
var config = require('../config.json');
var autoprefixer = require('gulp-autoprefixer'),
sass = require('gulp-sass'),
sassUnicode = require('gulp-sass-unicode'),
sourcemaps = require('gulp-sourcemaps');
sass.compiler = require('node-sass');
gulp.task('sass', function () {
return gulp.src(config.scss.location)
.pipe(sass({
includePaths: [
config.scss.externalFiles
],
sourcemap: true
}).on('error', sass.logError))
.pipe(sassUnicode())
.pipe(autoprefixer({
browsers: config.browsers
}))
.pipe(sourcemaps.write(''))
.pipe(gulp.dest(config.scss.destination));
});
\ No newline at end of file
var gulp = require('gulp');
var config = require('../config.json');
gulp.task('watch', function () {
gulp.watch(config.assets.location, ['copy-assets']);
gulp.watch(config.html.location, ['file-include', 'html-lint']);
gulp.watch(config.scss.location, ['sass', 'sass-lint']);
gulp.watch(config.js.location, ['scripts', 'js-lint']);
var gulp = require('gulp');
var config = require('../config.json');
gulp.task('watch', function () {
gulp.watch(config.assets.location, ['copy-assets']);
gulp.watch(config.html.location, ['file-include', 'html-lint']);
gulp.watch(config.scss.location, ['sass', 'sass-lint']);
gulp.watch(config.js.location, ['scripts', 'js-lint']);
});
\ No newline at end of file
var gulp = require('gulp');
var config = require('../config.json');
var webserver = require('gulp-webserver');
gulp.task('web-server', function() {
gulp.src(config.settings.destination)
.pipe(webserver({
livereload: true,
open: true,
port: 8888
}));
var gulp = require('gulp');
var config = require('../config.json');
var webserver = require('gulp-webserver');
gulp.task('web-server', function() {
gulp.src(config.settings.destination)
.pipe(webserver({
livereload: true,
open: true,
port: 8888
}));
});
\ No newline at end of file
var gulp = require('gulp');
var config = require('../config.json');
gulp.task('copy-assets', function () {
return gulp.src(config.assets.location)
.pipe(gulp.dest(config.assets.destination));
var gulp = require('gulp');
var config = require('../config.json');
gulp.task('copy-assets', function () {
return gulp.src(config.assets.location)
.pipe(gulp.dest(config.assets.destination));
});
\ No newline at end of file
var gulp = require('gulp');
var config = require('../config.json');
var imageAlts = require('../../image-alts.json');
var fileinclude = require('gulp-file-include'),
gutil = require('gulp-util'),
htmlmin = require('gulp-htmlmin'),
inject = require('gulp-inject');
gulp.task('file-include', function () {
var sources = gulp.src([
config.scss.destination + config.settings.name + '.css',
config.js.destination + config.settings.name + '.js'
], {read: false});
return gulp.src(config.html.location)
.pipe(inject(sources, {
relative: true,
transform: function (filePath) {
return inject.transform.call(inject.transform, filePath.replace('../.' + config.settings.destination, ''));
}
}))
.pipe(inject(gulp.src(config.settings.favicon, {read: false}), {
starttag: '<!-- inject:htmlHead -->',
relative: true,
transform: function (filePath) {
return'<meta name="viewport" content="width=device-width, initial-scale=1">\n\t' +
'<meta charset="utf-8">\n\t' +
'<link rel="shortcut icon" href="' + filePath.replace('../.' + config.settings.destination, '') + '" type="image/x-icon">\n\t';
}
}))
.pipe(fileinclude({
indent: true,
basepath: config.html.partialsLocation
}))
.pipe(inject(gulp.src(config.assets.images, {read: false}), {
starttag: '<!-- injectImage:{{path}} -->',
ignorePath: config.assets.imagesLocation,
addRootSlash: false,
transform: function (filePath) {
if (!imageAlts[filePath]) {
return "Fix image alt!";
}
if (imageAlts.classes[filePath]) {
return '<img class="' + imageAlts.classes[filePath] + '" src="../assets/images/' + filePath + '" alt="' + imageAlts[filePath] + '">';
}
return '<img src="../assets/images/' + filePath + '" alt="' + imageAlts[filePath] + '">';
}
}))
.pipe(gutil.env.env !== 'dev' ? htmlmin({
removeComments: true
}) : gutil.noop())
.pipe(gulp.dest(config.html.destination));
var gulp = require('gulp');
var config = require('../config.json');
var imageAlts = require('../../image-alts.json');
var fileinclude = require('gulp-file-include'),
gutil = require('gulp-util'),
htmlmin = require('gulp-htmlmin'),
inject = require('gulp-inject');
gulp.task('file-include', function () {
var sources = gulp.src([
config.scss.destination + config.settings.name + '.css',
config.js.destination + config.settings.name + '.js'
], {read: false});
return gulp.src(config.html.location)
.pipe(inject(sources, {
relative: true,
transform: function (filePath) {
return inject.transform.call(inject.transform, filePath.replace('../.' + config.settings.destination, ''));
}
}))
.pipe(inject(gulp.src(config.settings.favicon, {read: false}), {
starttag: '<!-- inject:htmlHead -->',
relative: true,
transform: function (filePath) {
return'<meta name="viewport" content="width=device-width, initial-scale=1">\n\t' +
'<meta charset="utf-8">\n\t' +
'<link rel="shortcut icon" href="' + filePath.replace('../.' + config.settings.destination, '') + '" type="image/x-icon">\n\t';
}
}))
.pipe(fileinclude({
indent: true,
basepath: config.html.partialsLocation
}))
.pipe(inject(gulp.src(config.assets.images, {read: false}), {
starttag: '<!-- injectImage:{{path}} -->',
ignorePath: config.assets.imagesLocation,
addRootSlash: false,
transform: function (filePath) {
if (!imageAlts[filePath]) {
return "Fix image alt!";
}
if (imageAlts.classes[filePath]) {
return '<img class="' + imageAlts.classes[filePath] + '" src="../assets/images/' + filePath + '" alt="' + imageAlts[filePath] + '">';
}
return '<img src="../assets/images/' + filePath + '" alt="' + imageAlts[filePath] + '">';
}
}))
.pipe(gutil.env.env !== 'dev' ? htmlmin({
removeComments: true
}) : gutil.noop())
.pipe(gulp.dest(config.html.destination));
});
\ No newline at end of file
var gulp = require('gulp');
var config = require('../config.json');
var concat = require('gulp-concat'),
gutil = require('gulp-util'),
uglify = require('gulp-uglify');
gulp.task('scripts', function () {
var location = config.js.externalFiles;
location.push(config.js.location);
return gulp.src(location)
.pipe(concat(config.settings.name + '.js'))
.pipe(gutil.env.env !== 'dev' ? uglify() : gutil.noop())
.pipe(gulp.dest(config.js.destination));
var gulp = require('gulp');
var config = require('../config.json');
var concat = require('gulp-concat'),
gutil = require('gulp-util'),
uglify = require('gulp-uglify');
gulp.task('scripts', function () {
var location = config.js.externalFiles;
location.push(config.js.location);
return gulp.src(location)
.pipe(concat(config.settings.name + '.js'))
.pipe(gutil.env.env !== 'dev' ? uglify() : gutil.noop())
.pipe(gulp.dest(config.js.destination));
});
\ No newline at end of file
var gulp = require('gulp');
var runSequence = require('run-sequence').use(gulp);
gulp.task('default', function () {
runSequence(
['sass', 'scripts', 'copy-assets'],
'file-include',
'minify-css'
);
var gulp = require('gulp');
var runSequence = require('run-sequence').use(gulp);
gulp.task('default', function () {
runSequence(
['sass', 'scripts', 'copy-assets'],
'file-include',
'minify-css'
);
});
\ No newline at end of file
var gulp = require('gulp');
var cleanCSS = require('gulp-clean-css');
gulp.task('minify-css', function () {
return gulp.src('./dist/css/*.css')
.pipe(cleanCSS({compatibility: '*'}))
.pipe(gulp.dest('./dist/css/'));
var gulp = require('gulp');
var cleanCSS = require('gulp-clean-css');
gulp.task('minify-css', function () {
return gulp.src('./dist/css/*.css')
.pipe(cleanCSS({compatibility: '*'}))
.pipe(gulp.dest('./dist/css/'));
});
\ No newline at end of file
var gulp = require('gulp');
var config = require('../config.json');
var autoprefixer = require('gulp-autoprefixer'),
sass = require('gulp-sass'),
sassUnicode = require('gulp-sass-unicode');
sass.compiler = require('node-sass');
gulp.task('sass', function() {
return gulp.src(config.scss.location)
.pipe(sass({
includePaths: [
config.scss.externalFiles
]
}).on('error', sass.logError))
.pipe(sassUnicode())
.pipe(autoprefixer({
browsers: config.browsers
}))
.pipe(gulp.dest(config.scss.destination));
var gulp = require('gulp');
var config = require('../config.json');
var autoprefixer = require('gulp-autoprefixer'),
sass = require('gulp-sass'),
sassUnicode = require('gulp-sass-unicode');
sass.compiler = require('node-sass');
gulp.task('sass', function() {
return gulp.src(config.scss.location)
.pipe(sass({
includePaths: [
config.scss.externalFiles
]
}).on('error', sass.logError))
.pipe(sassUnicode())
.pipe(autoprefixer({
browsers: config.browsers
}))
.pipe(gulp.dest(config.scss.destination));
});
\ No newline at end of file