Update workflow/conventions/tools

This commit is contained in:
Maxime Thirouin
2014-05-04 08:16:31 +02:00
parent a17a6b90be
commit 48376db0ef
7 changed files with 199 additions and 132 deletions

1
.gitignore vendored
View File

@@ -1 +1,2 @@
.DS_Store
node_modules/

View File

@@ -1,112 +1,143 @@
{
"excludeFiles": [
]
, "requireCurlyBraces": [
"if"
, "else"
, "for"
, "while"
, "do"
, "try"
, "catch"
]
, "requireSpaceAfterKeywords": [
"if"
, "else"
, "for"
, "while"
, "do"
, "switch"
, "return"
, "try"
, "catch"
]
, "requireSpacesInFunctionExpression": {
"excludeFiles": [],
"requireCurlyBraces": [
"if",
"else",
"for",
"while",
"do",
"try",
"catch"
],
"requireSpaceAfterKeywords": [
"if",
"else",
"for",
"while",
"do",
"switch",
"return",
"try",
"catch"
],
"requireSpacesInFunctionExpression": {
"beforeOpeningCurlyBrace": true
}
, "disallowSpacesInFunctionExpression": {
},
"disallowSpacesInFunctionExpression": {
"beforeOpeningRoundBrace": true
}
, "disallowEmptyBlocks": true
, "disallowSpacesInsideObjectBrackets": true
, "disallowSpacesInsideArrayBrackets": true
, "disallowSpacesInsideParentheses": true
, "disallowSpaceAfterObjectKeys": true
, "disallowCommaBeforeLineBreak": true
, "requireOperatorBeforeLineBreak": [
"?"
, "+"
, "-"
, "/"
, "*"
, "="
, "=="
, "==="
, "!="
, "!=="
, ">"
, ">="
, "<"
, "<="
]
, "disallowSpaceAfterPrefixUnaryOperators": [
"++"
, "--"
, "+"
, "-"
, "~"
, "!"
]
, "disallowSpaceBeforePostfixUnaryOperators": [
"++"
, "--"
]
, "requireSpaceBeforeBinaryOperators": [
"+"
, "-"
, "/"
, "*"
, "="
, "=="
, "==="
, "!="
, "!=="
]
, "requireSpaceAfterBinaryOperators": [
"+"
, "-"
, "/"
, "*"
, "="
, "=="
, "==="
, "!="
, "!=="
]
, "disallowImplicitTypeConversion": [
"numeric"
, "boolean"
, "binary"
, "string"
]
, "disallowKeywords": [
},
"disallowEmptyBlocks": true,
"disallowSpacesInsideParentheses": true,
"disallowSpacesInsideObjectBrackets": true,
"disallowSpacesInsideArrayBrackets": true,
"disallowQuotedKeysInObjects": "allButReserved",
"disallowSpaceAfterObjectKeys": true,
"requireCommaBeforeLineBreak": true,
"requireOperatorBeforeLineBreak": [
"?",
"+",
"-",
"/",
"*",
"=",
"==",
"===",
"!=",
"!==",
">",
">=",
"<",
"<="
],
"disallowLeftStickedOperators": [
"?",
"+",
"-",
"/",
"*",
"=",
"==",
"===",
"!=",
"!==",
">",
">=",
"<",
"<="
],
"requireRightStickedOperators": [
"!"
],
"disallowRightStickedOperators": [
"?",
"+",
"/",
"*",
":",
"=",
"==",
"===",
"!=",
"!==",
">",
">=",
"<",
"<="
],
"disallowSpaceAfterPrefixUnaryOperators": [
"++",
"--",
"+",
"-",
"~",
"!"
],
"disallowSpaceBeforePostfixUnaryOperators": [
"++",
"--"
],
"requireSpaceBeforeBinaryOperators": [
"+",
"-",
"/",
"*",
"=",
"==",
"===",
"!=",
"!=="
],
"requireSpaceAfterBinaryOperators": [
"+",
"-",
"/",
"*",
"=",
"==",
"===",
"!=",
"!=="
],
"disallowImplicitTypeConversion": [
"numeric",
"boolean",
"binary",
"string"
],
"disallowKeywords": [
"with"
]
, "disallowMultipleLineStrings": true
, "validateQuoteMarks": "\""
, "disallowMixedSpacesAndTabs": true
, "disallowTrailingWhitespace": true
, "requireKeywordsOnNewLine": [
]
, "requireLineFeedAtFileEnd": true
, "requireCapitalizedConstructors": true
, "safeContextKeyword": "that"
, "validateJSDoc": {
"checkParamNames": true
, "checkRedundantParams": true
, "requireParamTypes": true
],
"disallowMultipleLineStrings": true,
"validateQuoteMarks": "\"",
"disallowMixedSpacesAndTabs": true,
"disallowTrailingWhitespace": true,
"requireKeywordsOnNewLine": [],
"requireLineFeedAtFileEnd": true,
"requireCapitalizedConstructors": true,
"safeContextKeyword": "that",
"validateJSDoc": {
"checkParamNames": true,
"checkRedundantParams": true,
"requireParamTypes": true
}
}

View File

@@ -1,4 +1,4 @@
{
"asi": true
, "laxcomma": true
"asi": true,
"laxcomma": true
}

35
Gulpfile.js Normal file
View 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)
})

View File

@@ -135,8 +135,8 @@ Let's talk more about the most basic way to get started:
```js
new Pjax({
elements: "a" // default is "a[href], form[action]"
, selectors: ["title", ".my-Header", ".my-Content", ".my-Sidebar"]
elements: "a", // default is "a[href], form[action]"
selectors: ["title", ".my-Header", ".my-Content", ".my-Sidebar"]
})
```
@@ -203,8 +203,8 @@ Examples:
```js
new Pjax({
selectors: ["title", ".Navbar", ".js-Pjax"]
, switches: {
selectors: ["title", ".Navbar", ".js-Pjax"],
switches: {
// "title": Pjax.switches.outerHTML // default behavior
".Navbar": function(oldEl, newEl, options) {
// here it's a stupid example since it's the default behavior too
@@ -249,23 +249,23 @@ with or without [WOW.js](https://github.com/matthieua/WOW).
```js
new Pjax({
selectors: ["title", ".js-Pjax"]
, switches: {
selectors: ["title", ".js-Pjax"],
switches: {
".js-Pjax": Pjax.switches.sideBySide
}
, switchesOptions: {
},
switchesOptions: {
".js-Pjax": {
classNames: {
// 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
, add: "Animated"
add: "Animated",
// 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)
, forward: "Animate--slideInLeft"
}
, callbacks: {
forward: "Animate--slideInLeft"
},
callbacks: {
// to make a nice transition with 2 pages as the same time
// we are playing with absolute positioning for element we are removing
// & we need live metrics to have something great
@@ -495,9 +495,9 @@ wrapper on each page (to avoid differences of DOM between pages)
```html
<script>
var disqus_shortname = 'YOURSHORTNAME'
, disqus_identifier = 'PAGEID'
, disqus_url = 'PAGEURL'
, disqus_script = 'embed.js'
var disqus_identifier = 'PAGEID'
var disqus_url = 'PAGEURL'
var disqus_script = 'embed.js'
(function(d,s) {
s = d.createElement('script');s.async=1;s.src = '//' + disqus_shortname + '.disqus.com/'+disqus_script;
(d.getElementsByTagName('head')[0]).appendChild(s);
@@ -512,9 +512,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 -->
<script>
var disqus_shortname = 'YOURSHORTNAME'
, disqus_identifier = 'PAGEID'
, disqus_url = 'PAGEURL'
, disqus_script = 'embed.js'
var disqus_identifier = 'PAGEID'
var disqus_url = 'PAGEURL'
var disqus_script = 'embed.js'
// here we will only load the disqus <script> if not already loaded
if (!window.DISQUS) {

View File

@@ -30,7 +30,7 @@
"devDependencies": {
"jscs": "^1.6.2",
"jshint": "^2.5.6",
"postcss": "^2.2.5"
"tape": "^3.0.0"
},
"scripts": {
"lint": "jscs **/*.js && jshint . --exclude-path .gitignore",

View File