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/ node_modules/

View File

@@ -1,112 +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,
, "disallowSpacesInsideObjectBrackets": true "disallowSpacesInsideParentheses": true,
, "disallowSpacesInsideArrayBrackets": true "disallowSpacesInsideObjectBrackets": true,
, "disallowSpacesInsideParentheses": true "disallowSpacesInsideArrayBrackets": true,
, "disallowSpaceAfterObjectKeys": true "disallowQuotedKeysInObjects": "allButReserved",
, "disallowCommaBeforeLineBreak": true "disallowSpaceAfterObjectKeys": true,
, "requireOperatorBeforeLineBreak": [ "requireCommaBeforeLineBreak": true,
"?" "requireOperatorBeforeLineBreak": [
, "+" "?",
, "-" "+",
, "/" "-",
, "*" "/",
, "=" "*",
, "==" "=",
, "===" "==",
, "!=" "===",
, "!==" "!=",
, ">" "!==",
, ">=" ">",
, "<" ">=",
, "<=" "<",
] "<="
, "disallowSpaceAfterPrefixUnaryOperators": [ ],
"++" "disallowLeftStickedOperators": [
, "--" "?",
, "+" "+",
, "-" "-",
, "~" "/",
, "!" "*",
] "=",
, "disallowSpaceBeforePostfixUnaryOperators": [ "==",
"++" "===",
, "--" "!=",
] "!==",
, "requireSpaceBeforeBinaryOperators": [ ">",
"+" ">=",
, "-" "<",
, "/" "<="
, "*" ],
, "=" "requireRightStickedOperators": [
, "==" "!"
, "===" ],
, "!=" "disallowRightStickedOperators": [
, "!==" "?",
] "+",
, "requireSpaceAfterBinaryOperators": [ "/",
"+" "*",
, "-" ":",
, "/" "=",
, "*" "==",
, "=" "===",
, "==" "!=",
, "===" "!==",
, "!=" ">",
, "!==" ">=",
] "<",
, "disallowImplicitTypeConversion": [ "<="
"numeric" ],
, "boolean" "disallowSpaceAfterPrefixUnaryOperators": [
, "binary" "++",
, "string" "--",
] "+",
, "disallowKeywords": [ "-",
"~",
"!"
],
"disallowSpaceBeforePostfixUnaryOperators": [
"++",
"--"
],
"requireSpaceBeforeBinaryOperators": [
"+",
"-",
"/",
"*",
"=",
"==",
"===",
"!=",
"!=="
],
"requireSpaceAfterBinaryOperators": [
"+",
"-",
"/",
"*",
"=",
"==",
"===",
"!=",
"!=="
],
"disallowImplicitTypeConversion": [
"numeric",
"boolean",
"binary",
"string"
],
"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
} }
} }

View File

@@ -1,4 +1,4 @@
{ {
"asi": true "asi": true,
, "laxcomma": 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 ```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"]
}) })
``` ```
@@ -203,8 +203,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
@@ -249,23 +249,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
} },
, switchesOptions: { switchesOptions: {
".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
@@ -495,9 +495,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);
@@ -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 --> <!-- 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) {

View File

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

View File