From 48376db0efc83598a5162c4a07cdc993921919d7 Mon Sep 17 00:00:00 2001 From: Maxime Thirouin Date: Sun, 4 May 2014 08:16:31 +0200 Subject: [PATCH] Update workflow/conventions/tools --- .gitignore | 1 + .jscs.json | 249 ++++++++++++++++++++++++++--------------------- .jshintrc | 4 +- Gulpfile.js | 35 +++++++ README.md | 40 ++++---- package.json | 2 +- tests/todo,sorry | 0 7 files changed, 199 insertions(+), 132 deletions(-) create mode 100644 Gulpfile.js delete mode 100644 tests/todo,sorry diff --git a/.gitignore b/.gitignore index c2658d7..646ac51 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ +.DS_Store node_modules/ diff --git a/.jscs.json b/.jscs.json index a03292c..e4169a9 100644 --- a/.jscs.json +++ b/.jscs.json @@ -1,112 +1,143 @@ { - "excludeFiles": [ - ] - , "requireCurlyBraces": [ - "if" - , "else" - , "for" - , "while" - , "do" - , "try" - , "catch" - ] - , "requireSpaceAfterKeywords": [ - "if" - , "else" - , "for" - , "while" - , "do" - , "switch" - , "return" - , "try" - , "catch" - ] - , "requireSpacesInFunctionExpression": { - "beforeOpeningCurlyBrace": true - } - , "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": [ - "with" - ] - , "disallowMultipleLineStrings": true - - , "validateQuoteMarks": "\"" - , "disallowMixedSpacesAndTabs": true - , "disallowTrailingWhitespace": true - - , "requireKeywordsOnNewLine": [ - ] - , "requireLineFeedAtFileEnd": true - , "requireCapitalizedConstructors": true - , "safeContextKeyword": "that" - - , "validateJSDoc": { - "checkParamNames": true - , "checkRedundantParams": true - , "requireParamTypes": true + "excludeFiles": [], + "requireCurlyBraces": [ + "if", + "else", + "for", + "while", + "do", + "try", + "catch" + ], + "requireSpaceAfterKeywords": [ + "if", + "else", + "for", + "while", + "do", + "switch", + "return", + "try", + "catch" + ], + "requireSpacesInFunctionExpression": { + "beforeOpeningCurlyBrace": true + }, + "disallowSpacesInFunctionExpression": { + "beforeOpeningRoundBrace": true + }, + "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 } } diff --git a/.jshintrc b/.jshintrc index 7568631..182e34d 100644 --- a/.jshintrc +++ b/.jshintrc @@ -1,4 +1,4 @@ { - "asi": true - , "laxcomma": true + "asi": true, + "laxcomma": true } diff --git a/Gulpfile.js b/Gulpfile.js new file mode 100644 index 0000000..2c52c96 --- /dev/null +++ b/Gulpfile.js @@ -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) +}) diff --git a/README.md b/README.md index e9f4ba0..02ef9ca 100644 --- a/README.md +++ b/README.md @@ -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