lkiarest / blog Goto Github PK
View Code? Open in Web Editor NEWlkiarest's blog
lkiarest's blog
为了不用每次写一些小页面的时候都要重新配一把,保存一份待复用。
gulpfile.js
var path = require('path')
var gulp = require('gulp')
var rename = require("gulp-rename")
var cleanCSS = require('gulp-clean-css')
var less = require('gulp-less')
var LessAutoprefix = require('less-plugin-autoprefix')
var autoprefix = new LessAutoprefix({ browsers: ['>5%'] })
var concat = require('gulp-concat');
var uglify = require('gulp-uglify');
gulp.task('style', function(cb) {
return gulp.src('style/main.less')
.pipe(less({
paths: [path.join(__dirname, 'less', 'includes')],
plugins: [autoprefix]
}))
.pipe(cleanCSS())
.pipe(rename('index.min.css'))
.pipe(gulp.dest('./dist/'))
})
gulp.task('script', function(cb) {
return gulp.src(['script/flexible.js', 'script/main.js'])
.pipe(uglify())
.pipe(rename({suffix: '.min'}))
.pipe(gulp.dest('./dist/'))
})
gulp.task('watch', function(cb) {
gulp.watch('style/main.less', ['style'])
gulp.watch('script/main.js', ['script'])
})
gulp.task('default', ['style', 'script', 'watch'])
package.json:
{
"name": "test",
"version": "1.0.0",
"description": "test page",
"main": "index.js",
"author": "qintx",
"scripts": {
"build": "gulp"
},
"devDependencies": {
"gulp": "^3.9.1",
"gulp-clean-css": "^3.9.0",
"gulp-concat": "^2.6.1",
"gulp-less": "^3.3.2",
"gulp-rename": "^1.2.2",
"gulp-uglify": "^3.0.0",
"less-plugin-autoprefix": "^1.5.1"
}
}
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.