Update gulpfile from my boilerplate & relocate pjax.js into src folder
This commit is contained in:
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "pjax",
|
||||
"main": "pjax.js",
|
||||
"version": "0.1.1",
|
||||
"description": "Boost browsing experience using Ajax navigation (+ Push state)",
|
||||
"main": "src/pjax.js",
|
||||
"homepage": "https://github.com/MoOx/pjax",
|
||||
"authors": [
|
||||
"Maxime Thirouin <m@moox.io>"
|
||||
],
|
||||
"description": "Boost browsing experience using Ajax navigation (+ Push state)",
|
||||
"moduleType": [
|
||||
"amd",
|
||||
"globals",
|
||||
|
||||
39
gulpfile.js
39
gulpfile.js
@@ -1,31 +1,56 @@
|
||||
///
|
||||
var pkg = require("./package.json")
|
||||
, gulp = require("gulp")
|
||||
, plumber = require("gulp-plumber")
|
||||
|
||||
///
|
||||
// Lint JS
|
||||
// JS Lint
|
||||
///
|
||||
var jshint = require("gulp-jshint")
|
||||
, jsFiles = [".jshintrc", "*.json", "*.js"]
|
||||
, jsonFiles = [".jshintrc", "*.json"]
|
||||
, jsFiles = ["*.js", "src/**/*.js"]
|
||||
gulp.task("scripts.lint", function() {
|
||||
gulp.src(jsFiles)
|
||||
gulp.src([].concat(jsonFiles).concat(jsFiles))
|
||||
.pipe(plumber())
|
||||
.pipe(jshint(".jshintrc"))
|
||||
.pipe(jshint.reporter("jshint-stylish"))
|
||||
})
|
||||
|
||||
///
|
||||
// JS Code Sniffing
|
||||
///
|
||||
var jscs = require("gulp-jscs")
|
||||
gulp.task("scripts.cs", function() {
|
||||
gulp.src("*.js")
|
||||
gulp.src(jsFiles)
|
||||
.pipe(plumber())
|
||||
.pipe(jscs())
|
||||
})
|
||||
|
||||
// JS Alias
|
||||
gulp.task("scripts", ["scripts.lint", "scripts.cs"])
|
||||
|
||||
///
|
||||
// Watch
|
||||
///
|
||||
gulp.task("watch", function() {
|
||||
gulp.watch([jsFiles], ["scripts"])
|
||||
gulp.watch(jsFiles, ["scripts"])
|
||||
})
|
||||
|
||||
gulp.task("default", ["scripts", "watch"])
|
||||
///
|
||||
// Publish gh-branch
|
||||
///
|
||||
var buildBranch = require("buildbranch")
|
||||
gulp.task("publish", ["test"], function(cb) {
|
||||
buildBranch({folder: "src"}
|
||||
, function(err) {
|
||||
if (err) {
|
||||
throw err
|
||||
}
|
||||
console.log(pkg.name + " published.")
|
||||
cb()
|
||||
})
|
||||
})
|
||||
|
||||
// Aliases
|
||||
gulp.task("build", ["scripts"])
|
||||
gulp.task("test", ["build"])
|
||||
gulp.task("default", ["test", "watch"])
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
"name": "pjax",
|
||||
"version": "0.1.1",
|
||||
"description": "Boost browsing experience using Ajax navigation (+ Push state)",
|
||||
"main": "pjax.js",
|
||||
"main": "src/pjax.js",
|
||||
"scripts": {
|
||||
"test": "echo \"Error: no test specified\" && exit 1"
|
||||
},
|
||||
@@ -30,6 +30,7 @@
|
||||
"gulp-jscs": "^0.3.2",
|
||||
"gulp-plumber": "^0.5.6",
|
||||
"gulp": "^3.5.6",
|
||||
"gulp-jshint": "^1.5.1"
|
||||
"gulp-jshint": "^1.5.1",
|
||||
"buildbranch": "0.0.1"
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user