Skip to content

Instantly share code, notes, and snippets.

@jonkemp
Last active Apr 11, 2017
Embed
What would you like to do?
gulp-jquery-t3 sample project
# editorconfig.org
root = true
[*]
indent_style = space
indent_size = 2
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
[*.md]
trim_trailing_whitespace = false
{
"env": {
"mocha": true,
"node": true
},
"globals": {
"Box": true
},
"extends": "eslint:recommended",
"rules": {
"block-scoped-var": 2,
"complexity": [
1,
5
],
"consistent-return": 2,
"curly": [
2,
"all"
],
"dot-notation": 2,
"eqeqeq": 2,
"no-caller": 2,
"no-console": 0,
"no-else-return": 2,
"no-eq-null": 2,
"no-extend-native": 2,
"no-implicit-coercion": 2,
"no-invalid-this": 2,
"no-loop-func": 2,
"no-multi-spaces": 2,
"no-multi-str": 2,
"no-new-func": 2,
"no-new-wrappers": 2,
"no-new": 2,
"no-param-reassign": 1,
"no-unused-expressions": 2,
"no-useless-call": 2,
"no-useless-concat": 2,
"no-with": 2,
"vars-on-top": 2,
"wrap-iife": [2, "any"],
"yoda": [
2,
"never"
],
"strict": [
2,
"global"
],
"no-shadow": 2,
"no-use-before-define": 2,
"callback-return": 2,
"handle-callback-err": 2,
"no-path-concat": 2,
"array-bracket-spacing": [
1,
"always", {
"objectsInArrays": false
}
],
"block-spacing": 1,
"brace-style": 1,
"camelcase": [
1, {
"properties": "never"
}
],
"comma-spacing": [
1, {
"before": false,
"after": true
}
],
"comma-style": [
1,
"last"
],
"computed-property-spacing": [
1,
"never"
],
"consistent-this": [
1,
"self"
],
"eol-last": 1,
"indent": [
2,
2, {
"SwitchCase": 1
}
],
"key-spacing": [
1, {
"beforeColon": false,
"afterColon": true
}
],
"keyword-spacing": 1,
"linebreak-style": [
1,
"unix"
],
"lines-around-comment": [
1, {
"allowBlockStart": true,
"beforeBlockComment": true,
"beforeLineComment": true
}
],
"max-depth": [
1,
4
],
"max-params": [
1,
3
],
"max-statements": [
1,
10
],
"new-cap": 2,
"new-parens": 2,
"newline-after-var": [
1,
"always"
],
"no-array-constructor": 2,
"no-bitwise": 1,
"no-lonely-if": 1,
"no-multi-spaces": 1,
"no-multiple-empty-lines": 1,
"no-new-object": 2,
"no-spaced-func": 1,
"no-trailing-spaces": 1,
"no-unneeded-ternary": 1,
"object-curly-spacing": [
1,
"always"
],
"one-var": 0,
"operator-assignment": [
1,
"always"
],
"operator-linebreak": [
1,
"after"
],
"quote-props": [
1,
"as-needed"
],
"quotes": [
1,
"single"
],
"semi": [
2,
"always"
],
"semi-spacing": [
1, {
"before": false,
"after": true
}
],
"space-before-blocks": [
1,
"always"
],
"space-before-function-paren": [1, "never"],
"space-in-parens": [1, "never"],
"space-infix-ops": 1,
"space-unary-ops": 0,
"spaced-comment": [1, "always", { "line": { "exceptions": ["-"] } }]
}
}
'use strict';
var gulp = require('gulp'),
del = require('del');
gulp.task('clean', del.bind(null, [ 'dist' ]));
gulp.task('lint', function() {
var eslint = require('gulp-eslint');
return gulp.src('scripts/**/*.js')
.pipe(eslint())
.pipe(eslint.format())
.pipe(eslint.failAfterError());
});
gulp.task('html', function() {
var uglify = require('gulp-uglify'),
cssnano = require('gulp-cssnano'),
useref = require('gulp-useref'),
gulpif = require('gulp-if');
return gulp.src('*.html')
.pipe(useref())
.pipe(gulpif(/\.js$/, uglify({ compress: { drop_console: true } })))
.pipe(gulpif(/\.css$/, cssnano({ safe: true, autoprefixer: false })))
.pipe(gulp.dest('dist'));
});
gulp.task('build', [ 'lint', 'html' ]);
gulp.task('default', [ 'clean' ], function() {
gulp.start('build');
});
<!doctype html>
<html lang="">
<head>
<meta charset="utf-8">
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title></title>
<link rel="apple-touch-icon" href="apple-touch-icon.png">
<!-- Place favicon.ico in the root directory -->
<!-- build:css styles/main.css -->
<link rel="stylesheet" href="styles/main.css">
<!-- endbuild -->
</head>
<body>
<!-- Google Analytics: change UA-XXXXX-X to be your site's ID. -->
<script>
(function(b,o,i,l,e,r){b.GoogleAnalyticsObject=l;b[l]||(b[l]=
function(){(b[l].q=b[l].q||[]).push(arguments)});b[l].l=+new Date;
e=o.createElement(i);r=o.getElementsByTagName(i)[0];
e.src='https://www.google-analytics.com/analytics.js';
r.parentNode.insertBefore(e,r)}(window,document,'script','ga'));
ga('create','UA-XXXXX-X');ga('send','pageview');
</script>
<!-- build:js scripts/main.js -->
<script src="./node_modules/jquery/dist/jquery.js"></script>
<script src="./node_modules/t3js/dist/t3.js"></script>
<script src="scripts/main.js"></script>
<!-- endbuild -->
</body>
</html>
'use strict';
Box.Application.init();
{
"name": "gulp-jquery-t3",
"version": "1.0.0",
"main": "index.js",
"author": "Jonathan Kemp",
"license": "MIT",
"devDependencies": {
"del": "^2.2.2",
"gulp": "^3.9.1",
"gulp-cssnano": "^2.1.2",
"gulp-eslint": "^3.0.1",
"gulp-if": "^2.0.2",
"gulp-uglify": "^2.1.2",
"gulp-useref": "^3.1.2"
},
"dependencies": {
"bootstrap": "^3.3.7",
"jquery": "^3.2.1",
"t3js": "^2.7.0"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment