Update workflow/conventions/tools
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -1 +1,2 @@
|
|||||||
|
.DS_Store
|
||||||
node_modules/
|
node_modules/
|
||||||
|
|||||||
284
.jscs.json
284
.jscs.json
@@ -1,147 +1,143 @@
|
|||||||
{
|
{
|
||||||
"excludeFiles": [
|
"excludeFiles": [],
|
||||||
]
|
"requireCurlyBraces": [
|
||||||
, "requireCurlyBraces": [
|
"if",
|
||||||
"if"
|
"else",
|
||||||
, "else"
|
"for",
|
||||||
, "for"
|
"while",
|
||||||
, "while"
|
"do",
|
||||||
, "do"
|
"try",
|
||||||
, "try"
|
"catch"
|
||||||
, "catch"
|
],
|
||||||
]
|
"requireSpaceAfterKeywords": [
|
||||||
, "requireSpaceAfterKeywords": [
|
"if",
|
||||||
"if"
|
"else",
|
||||||
, "else"
|
"for",
|
||||||
, "for"
|
"while",
|
||||||
, "while"
|
"do",
|
||||||
, "do"
|
"switch",
|
||||||
, "switch"
|
"return",
|
||||||
, "return"
|
"try",
|
||||||
, "try"
|
"catch"
|
||||||
, "catch"
|
],
|
||||||
]
|
"requireSpacesInFunctionExpression": {
|
||||||
, "requireSpacesInFunctionExpression": {
|
"beforeOpeningCurlyBrace": true
|
||||||
"beforeOpeningCurlyBrace": true
|
},
|
||||||
}
|
"disallowSpacesInFunctionExpression": {
|
||||||
, "disallowSpacesInFunctionExpression": {
|
"beforeOpeningRoundBrace": true
|
||||||
"beforeOpeningRoundBrace": true
|
},
|
||||||
}
|
"disallowEmptyBlocks": true,
|
||||||
, "disallowEmptyBlocks": true
|
"disallowSpacesInsideParentheses": true,
|
||||||
, "disallowSpacesInsideObjectBrackets": true
|
"disallowSpacesInsideObjectBrackets": true,
|
||||||
, "disallowSpacesInsideArrayBrackets": true
|
"disallowSpacesInsideArrayBrackets": true,
|
||||||
, "disallowSpacesInsideParentheses": true
|
"disallowQuotedKeysInObjects": "allButReserved",
|
||||||
, "disallowSpaceAfterObjectKeys": true
|
"disallowSpaceAfterObjectKeys": true,
|
||||||
, "disallowCommaBeforeLineBreak": true
|
"requireCommaBeforeLineBreak": true,
|
||||||
, "requireOperatorBeforeLineBreak": [
|
"requireOperatorBeforeLineBreak": [
|
||||||
"?"
|
"?",
|
||||||
, "+"
|
"+",
|
||||||
, "-"
|
"-",
|
||||||
, "/"
|
"/",
|
||||||
, "*"
|
"*",
|
||||||
, "="
|
"=",
|
||||||
, "=="
|
"==",
|
||||||
, "==="
|
"===",
|
||||||
, "!="
|
"!=",
|
||||||
, "!=="
|
"!==",
|
||||||
, ">"
|
">",
|
||||||
, ">="
|
">=",
|
||||||
, "<"
|
"<",
|
||||||
, "<="
|
"<="
|
||||||
]
|
],
|
||||||
, "disallowLeftStickedOperators": [
|
"disallowLeftStickedOperators": [
|
||||||
"?"
|
"?",
|
||||||
, "+"
|
"+",
|
||||||
, "-"
|
"-",
|
||||||
, "/"
|
"/",
|
||||||
, "*"
|
"*",
|
||||||
, "="
|
"=",
|
||||||
, "=="
|
"==",
|
||||||
, "==="
|
"===",
|
||||||
, "!="
|
"!=",
|
||||||
, "!=="
|
"!==",
|
||||||
, ">"
|
">",
|
||||||
, ">="
|
">=",
|
||||||
, "<"
|
"<",
|
||||||
, "<="
|
"<="
|
||||||
]
|
],
|
||||||
, "requireRightStickedOperators": [
|
"requireRightStickedOperators": [
|
||||||
"!"
|
"!"
|
||||||
]
|
],
|
||||||
, "disallowRightStickedOperators": [
|
"disallowRightStickedOperators": [
|
||||||
"?"
|
"?",
|
||||||
, "+"
|
"+",
|
||||||
, "/"
|
"/",
|
||||||
, "*"
|
"*",
|
||||||
, ":"
|
":",
|
||||||
, "="
|
"=",
|
||||||
, "=="
|
"==",
|
||||||
, "==="
|
"===",
|
||||||
, "!="
|
"!=",
|
||||||
, "!=="
|
"!==",
|
||||||
, ">"
|
">",
|
||||||
, ">="
|
">=",
|
||||||
, "<"
|
"<",
|
||||||
, "<="
|
"<="
|
||||||
]
|
],
|
||||||
, "disallowSpaceAfterPrefixUnaryOperators": [
|
"disallowSpaceAfterPrefixUnaryOperators": [
|
||||||
"++"
|
"++",
|
||||||
, "--"
|
"--",
|
||||||
, "+"
|
"+",
|
||||||
, "-"
|
"-",
|
||||||
, "~"
|
"~",
|
||||||
, "!"
|
"!"
|
||||||
]
|
],
|
||||||
, "disallowSpaceBeforePostfixUnaryOperators": [
|
"disallowSpaceBeforePostfixUnaryOperators": [
|
||||||
"++"
|
"++",
|
||||||
, "--"
|
"--"
|
||||||
]
|
],
|
||||||
, "requireSpaceBeforeBinaryOperators": [
|
"requireSpaceBeforeBinaryOperators": [
|
||||||
"+"
|
"+",
|
||||||
, "-"
|
"-",
|
||||||
, "/"
|
"/",
|
||||||
, "*"
|
"*",
|
||||||
, "="
|
"=",
|
||||||
, "=="
|
"==",
|
||||||
, "==="
|
"===",
|
||||||
, "!="
|
"!=",
|
||||||
, "!=="
|
"!=="
|
||||||
]
|
],
|
||||||
, "requireSpaceAfterBinaryOperators": [
|
"requireSpaceAfterBinaryOperators": [
|
||||||
"+"
|
"+",
|
||||||
, "-"
|
"-",
|
||||||
, "/"
|
"/",
|
||||||
, "*"
|
"*",
|
||||||
, "="
|
"=",
|
||||||
, "=="
|
"==",
|
||||||
, "==="
|
"===",
|
||||||
, "!="
|
"!=",
|
||||||
, "!=="
|
"!=="
|
||||||
]
|
],
|
||||||
, "disallowImplicitTypeConversion": [
|
"disallowImplicitTypeConversion": [
|
||||||
"numeric"
|
"numeric",
|
||||||
, "boolean"
|
"boolean",
|
||||||
, "binary"
|
"binary",
|
||||||
, "string"
|
"string"
|
||||||
]
|
],
|
||||||
, "disallowKeywords": [
|
"disallowKeywords": [
|
||||||
"with"
|
"with"
|
||||||
]
|
],
|
||||||
, "disallowMultipleLineStrings": true
|
"disallowMultipleLineStrings": true,
|
||||||
|
"validateQuoteMarks": "\"",
|
||||||
, "validateQuoteMarks": "\""
|
"disallowMixedSpacesAndTabs": true,
|
||||||
, "disallowMixedSpacesAndTabs": true
|
"disallowTrailingWhitespace": true,
|
||||||
, "disallowTrailingWhitespace": true
|
"requireKeywordsOnNewLine": [],
|
||||||
|
"requireLineFeedAtFileEnd": true,
|
||||||
, "requireKeywordsOnNewLine": [
|
"requireCapitalizedConstructors": true,
|
||||||
]
|
"safeContextKeyword": "that",
|
||||||
, "requireLineFeedAtFileEnd": true
|
"validateJSDoc": {
|
||||||
, "requireCapitalizedConstructors": true
|
"checkParamNames": true,
|
||||||
, "safeContextKeyword": "that"
|
"checkRedundantParams": true,
|
||||||
|
"requireParamTypes": true
|
||||||
, "validateJSDoc": {
|
|
||||||
"checkParamNames": true
|
|
||||||
, "checkRedundantParams": true
|
|
||||||
, "requireParamTypes": true
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
{
|
{
|
||||||
"asi": true
|
"asi": true,
|
||||||
, "laxcomma": true
|
"laxcomma": true
|
||||||
}
|
}
|
||||||
|
|||||||
35
Gulpfile.js
Normal file
35
Gulpfile.js
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
var gulp = require("gulp")
|
||||||
|
var server = require("./tasks/server")
|
||||||
|
|
||||||
|
gulp.task("clean", require("./tasks/clean"))
|
||||||
|
|
||||||
|
// html
|
||||||
|
// @todo
|
||||||
|
|
||||||
|
// static assets
|
||||||
|
|
||||||
|
// generated assets
|
||||||
|
gulp.task("scripts:linting", require("./tasks/scripts-linting"))
|
||||||
|
gulp.task("scripts", ["scripts:linting"], require("./tasks/scripts"))
|
||||||
|
// gulp.task("stylesheets", require("./tasks/stylesheets"))
|
||||||
|
|
||||||
|
// build
|
||||||
|
// gulp.task("dist", ["clean", "static", "scripts", "stylesheets"])
|
||||||
|
gulp.task("dist", ["clean", "scripts"])
|
||||||
|
|
||||||
|
// publish
|
||||||
|
gulp.task("publish", ["dist"], require("./tasks/publish"))
|
||||||
|
|
||||||
|
// dev tasks
|
||||||
|
// gulp.task("server", ["dist"], server.start)
|
||||||
|
// gulp.task("default", ["dist", "server", "watch" ])
|
||||||
|
gulp.task("default", ["dist", "watch" ])
|
||||||
|
gulp.task("test", ["dist"])
|
||||||
|
|
||||||
|
gulp.task("watch", ["dist"], function() {
|
||||||
|
gulp.watch("./styles/**/*.css", ["stylesheets"])
|
||||||
|
gulp.watch("./scripts/**/*.js", ["scripts"])
|
||||||
|
gulp.watch("./tasks/**/*.js", ["scripts:linting"])
|
||||||
|
|
||||||
|
// gulp.watch("./dist/**/*").on("change", server.livereload)
|
||||||
|
})
|
||||||
40
README.md
40
README.md
@@ -134,8 +134,8 @@ Let's talk more about the most basic way to get started:
|
|||||||
|
|
||||||
```js
|
```js
|
||||||
new Pjax({
|
new Pjax({
|
||||||
elements: "a" // default is "a[href], form[action]"
|
elements: "a", // default is "a[href], form[action]"
|
||||||
, selectors: ["title", ".my-Header", ".my-Content", ".my-Sidebar"]
|
selectors: ["title", ".my-Header", ".my-Content", ".my-Sidebar"]
|
||||||
})
|
})
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -202,8 +202,8 @@ Examples:
|
|||||||
|
|
||||||
```js
|
```js
|
||||||
new Pjax({
|
new Pjax({
|
||||||
selectors: ["title", ".Navbar", ".js-Pjax"]
|
selectors: ["title", ".Navbar", ".js-Pjax"],
|
||||||
, switches: {
|
switches: {
|
||||||
// "title": Pjax.switches.outerHTML // default behavior
|
// "title": Pjax.switches.outerHTML // default behavior
|
||||||
".Navbar": function(oldEl, newEl, options) {
|
".Navbar": function(oldEl, newEl, options) {
|
||||||
// here it's a stupid example since it's the default behavior too
|
// here it's a stupid example since it's the default behavior too
|
||||||
@@ -248,23 +248,23 @@ with or without [WOW.js](https://github.com/matthieua/WOW).
|
|||||||
|
|
||||||
```js
|
```js
|
||||||
new Pjax({
|
new Pjax({
|
||||||
selectors: ["title", ".js-Pjax"]
|
selectors: ["title", ".js-Pjax"],
|
||||||
, switches: {
|
switches: {
|
||||||
".js-Pjax": Pjax.switches.sideBySide
|
".js-Pjax": Pjax.switches.sideBySide
|
||||||
}
|
},
|
||||||
, switchesClasses: {
|
switchesClasses: {
|
||||||
".js-Pjax": {
|
".js-Pjax": {
|
||||||
classNames: {
|
classNames: {
|
||||||
// class added on the element that will be removed
|
// class added on the element that will be removed
|
||||||
remove: "Animated Animated--reverse Animate--fast Animate--noDelay"
|
remove: "Animated Animated--reverse Animate--fast Animate--noDelay",
|
||||||
// class added on the element that will be added
|
// class added on the element that will be added
|
||||||
, add: "Animated"
|
add: "Animated",
|
||||||
// class added on the element when it go backward
|
// class added on the element when it go backward
|
||||||
, backward: "Animate--slideInRight"
|
backward: "Animate--slideInRight",
|
||||||
// class added on the element when it go forward (used for new page too)
|
// class added on the element when it go forward (used for new page too)
|
||||||
, forward: "Animate--slideInLeft"
|
forward: "Animate--slideInLeft"
|
||||||
}
|
},
|
||||||
, callbacks: {
|
callbacks: {
|
||||||
// to make a nice transition with 2 pages as the same time
|
// to make a nice transition with 2 pages as the same time
|
||||||
// we are playing with absolute positioning for element we are removing
|
// we are playing with absolute positioning for element we are removing
|
||||||
// & we need live metrics to have something great
|
// & we need live metrics to have something great
|
||||||
@@ -490,9 +490,9 @@ wrapper on each page (to avoid differences of DOM between pages)
|
|||||||
```html
|
```html
|
||||||
<script>
|
<script>
|
||||||
var disqus_shortname = 'YOURSHORTNAME'
|
var disqus_shortname = 'YOURSHORTNAME'
|
||||||
, disqus_identifier = 'PAGEID'
|
var disqus_identifier = 'PAGEID'
|
||||||
, disqus_url = 'PAGEURL'
|
var disqus_url = 'PAGEURL'
|
||||||
, disqus_script = 'embed.js'
|
var disqus_script = 'embed.js'
|
||||||
(function(d,s) {
|
(function(d,s) {
|
||||||
s = d.createElement('script');s.async=1;s.src = '//' + disqus_shortname + '.disqus.com/'+disqus_script;
|
s = d.createElement('script');s.async=1;s.src = '//' + disqus_shortname + '.disqus.com/'+disqus_script;
|
||||||
(d.getElementsByTagName('head')[0]).appendChild(s);
|
(d.getElementsByTagName('head')[0]).appendChild(s);
|
||||||
@@ -507,9 +507,9 @@ wrapper on each page (to avoid differences of DOM between pages)
|
|||||||
<!-- if (blah blah) { // eventual server side test to know wheter or not you include this script -->
|
<!-- if (blah blah) { // eventual server side test to know wheter or not you include this script -->
|
||||||
<script>
|
<script>
|
||||||
var disqus_shortname = 'YOURSHORTNAME'
|
var disqus_shortname = 'YOURSHORTNAME'
|
||||||
, disqus_identifier = 'PAGEID'
|
var disqus_identifier = 'PAGEID'
|
||||||
, disqus_url = 'PAGEURL'
|
var disqus_url = 'PAGEURL'
|
||||||
, disqus_script = 'embed.js'
|
var disqus_script = 'embed.js'
|
||||||
|
|
||||||
// here we will only load the disqus <script> if not already loaded
|
// here we will only load the disqus <script> if not already loaded
|
||||||
if (!window.DISQUS) {
|
if (!window.DISQUS) {
|
||||||
|
|||||||
56
gulpfile.js
56
gulpfile.js
@@ -1,56 +0,0 @@
|
|||||||
var pkg = require("./package.json")
|
|
||||||
, gulp = require("gulp")
|
|
||||||
, plumber = require("gulp-plumber")
|
|
||||||
|
|
||||||
///
|
|
||||||
// JS Lint
|
|
||||||
///
|
|
||||||
var jshint = require("gulp-jshint")
|
|
||||||
, jsonFiles = [".jshintrc", "*.json"]
|
|
||||||
, jsFiles = ["*.js", "src/**/*.js"]
|
|
||||||
gulp.task("scripts.lint", function() {
|
|
||||||
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(jsFiles)
|
|
||||||
.pipe(plumber())
|
|
||||||
.pipe(jscs())
|
|
||||||
})
|
|
||||||
|
|
||||||
// JS Alias
|
|
||||||
gulp.task("scripts", ["scripts.lint", "scripts.cs"])
|
|
||||||
|
|
||||||
///
|
|
||||||
// Watch
|
|
||||||
///
|
|
||||||
gulp.task("watch", function() {
|
|
||||||
gulp.watch(jsFiles, ["scripts"])
|
|
||||||
})
|
|
||||||
|
|
||||||
///
|
|
||||||
// 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"])
|
|
||||||
23
package.json
23
package.json
@@ -26,11 +26,26 @@
|
|||||||
},
|
},
|
||||||
"homepage": "https://github.com/MoOx/pjax",
|
"homepage": "https://github.com/MoOx/pjax",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"jshint-stylish": "^0.1.5",
|
"connect": "^2.14.4",
|
||||||
"gulp-jscs": "^0.3.2",
|
"connect-livereload": "^0.3.2",
|
||||||
"gulp-plumber": "^0.5.6",
|
|
||||||
"gulp": "^3.5.6",
|
"gulp": "^3.5.6",
|
||||||
|
"gulp-autoprefixer": "0.0.7",
|
||||||
|
"gulp-browserify": "^0.5.0",
|
||||||
|
"gulp-gh-pages": "^0.2.0",
|
||||||
|
"gulp-jscs": "^0.3.2",
|
||||||
"gulp-jshint": "^1.5.1",
|
"gulp-jshint": "^1.5.1",
|
||||||
"buildbranch": "0.0.1"
|
"gulp-livereload": "^1.3.1",
|
||||||
|
"gulp-plumber": "^0.5.6",
|
||||||
|
"gulp-rework": "^0.2.2",
|
||||||
|
"gulp-util": "^2.2.14",
|
||||||
|
"jshint-stylish": "^0.1.5",
|
||||||
|
"minimist": "0.0.8",
|
||||||
|
"opn": "^0.1.1",
|
||||||
|
"rework": "^0.20.2",
|
||||||
|
"rework-calc": "^0.2.1",
|
||||||
|
"rework-vars": "^2.0.0",
|
||||||
|
"rimraf": "^2.2.6",
|
||||||
|
"tape": "^2.12.3",
|
||||||
|
"uglifyify": "^2.1.1"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user