forked from unit/website
Initial commit
This commit is contained in:
parent
6f1b7169da
commit
f2402829b1
2
.gitignore
vendored
Normal file
2
.gitignore
vendored
Normal file
|
@ -0,0 +1,2 @@
|
|||
node_modules/
|
||||
dist/
|
76
gulpfile.js
Normal file
76
gulpfile.js
Normal 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
25
package.json
Normal 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"
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user