Initial commit

This commit is contained in:
subnixr 2017-05-28 18:59:07 +02:00
parent 6f1b7169da
commit f2402829b1
3 changed files with 103 additions and 0 deletions

2
.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
node_modules/
dist/

76
gulpfile.js Normal file
View File

@ -0,0 +1,76 @@
var path = require('path');
var browserify = require('browserify');
var watchify = require('watchify');
var source = require('vinyl-source-stream');
var gulp = require('gulp');
var newer = require('gulp-newer');
var clean = require('gulp-clean');
var less = require('gulp-less');
var package = require('./package.json');
var folders = {
src: 'src/',
dist: 'dist/'
};
var browserifyOpts = {
entries: [package.main],
transform: [],
extensions: ['.js', '.json'],
cache: {},
packageCache: {}
};
function blob(fpath, extension) {
return path.join(fpath, '**', '*.' + extension);
}
// Tasks
gulp.task('default', ['build']);
gulp.task('build', ['application', 'style', 'static']);
gulp.task('clean', function () {
gulp.src(folders.dist)
.pipe(clean());
});
// By domain
gulp.task('application', ['js']);
gulp.task('style', ['less']);
gulp.task('static', ['html', 'svg']);
// By file
gulp.task('html', function () {
gulp.src(blob(folders.src, 'html'))
.pipe(newer(folders.dist))
.pipe(gulp.dest(folders.dist));
});
gulp.task('js', function () {
var brow = browserify(browserifyOpts)
brow.bundle()
.pipe(source('index.js'))
.pipe(gulp.dest(folders.dist));
});
gulp.task('less', function () {
var srcs = [
blob(folders.src, 'css'),
blob(folders.src, 'less')
];
gulp.src(srcs)
.pipe(less())
.pipe(gulp.dest(folders.dist));
});
gulp.task('svg', function () {
gulp.src(blob(folders.src, 'svg'))
.pipe(newer(folders.dist))
.pipe(gulp.dest(folders.dist));
});

25
package.json Normal file
View File

@ -0,0 +1,25 @@
{
"name": "unit-website",
"version": "0.0.1",
"description": "Unit fron page",
"main": "src/index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"repository": {
"type": "git",
"url": "git@git.unit.macaomilano.org:subnixr/website.git"
},
"author": "Unit",
"license": "GPL-3.0",
"devDependencies": {
"browserify": "^14.4.0",
"gulp": "^3.9.1",
"gulp-clean": "^0.3.2",
"gulp-less": "^3.3.0",
"gulp-newer": "^1.3.0",
"vinyl-source-stream": "^1.1.0",
"vinyl-transform": "^1.0.0",
"watchify": "^3.9.0"
}
}