Skip to content

Commit d2bf660

Browse files
committed
Initial Commit
1 parent b564209 commit d2bf660

16 files changed

+342
-0
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
node_modules/
2+
package-lock.json

.sass-lint.yml

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
options:
2+
formatter: stylish
3+
files:
4+
include: '**/*.s+(a|c)ss'
5+
rules:
6+
# Extends
7+
extends-before-mixins: 1
8+
extends-before-declarations: 1
9+
placeholder-in-extend: 1
10+
11+
# Mixins
12+
mixins-before-declarations: 0
13+
14+
# Line Spacing
15+
one-declaration-per-line: 1
16+
empty-line-between-blocks: 0
17+
single-line-per-selector: 1
18+
19+
# Disallows
20+
no-color-keywords: 1
21+
no-color-literals: 0
22+
no-css-comments: 1
23+
no-debug: 1
24+
no-duplicate-properties: 1
25+
no-empty-rulesets: 1
26+
no-extends: 0
27+
no-ids: 0
28+
no-important: 1
29+
no-invalid-hex: 1
30+
no-mergeable-selectors: 1
31+
no-misspelled-properties: 0
32+
no-qualifying-elements: 0
33+
no-trailing-whitespace: 1
34+
no-trailing-zero: 1
35+
no-transition-all: 0
36+
no-url-protocols: 1
37+
no-vendor-prefixes: 1
38+
no-warn: 1
39+
property-units: 0
40+
41+
# Nesting
42+
force-attribute-nesting: 0
43+
force-element-nesting: 0
44+
force-pseudo-nesting: 0
45+
46+
# Name Formats
47+
class-name-format: 1
48+
function-name-format: 1
49+
id-name-format: 0
50+
mixin-name-format: 1
51+
placeholder-name-format: 1
52+
variable-name-format: 1
53+
54+
# Style Guide
55+
bem-depth: 0
56+
border-zero: 1
57+
brace-style: 1
58+
clean-import-paths: 1
59+
empty-args: 1
60+
hex-length: 1
61+
hex-notation: 1
62+
indentation: 0
63+
leading-zero: 1
64+
nesting-depth:
65+
- 1
66+
- max-depth: 4
67+
property-sort-order: 0
68+
quotes: 1
69+
shorthand-values: 1
70+
url-quotes: 1
71+
variable-for-property: 1
72+
zero-unit: 1
73+
74+
# Inner Spacing
75+
space-after-comma: 1
76+
space-before-colon: 1
77+
space-after-colon: 1
78+
space-before-brace: 1
79+
space-before-bang: 1
80+
space-after-bang: 1
81+
space-between-parens: 1
82+
space-around-operator: 1
83+
84+
# Final Items
85+
trailing-semicolon: 1
86+
final-newline: 0

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#Super Simple Parallax
2+
3+
This aims to a super simple parallax plugin driven by CSS custom properties and transforms.

gulp/tasks/clean.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
'use strict';
2+
3+
var gulp = require('gulp');
4+
var del = require('del');
5+
6+
gulp.task('clean', function() {
7+
return del(global.destination);
8+
});

gulp/tasks/copy.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
'use strict';
2+
3+
var gulp = require('gulp');
4+
5+
gulp.task('copy', function () {
6+
var staticAssets = gulp.src([
7+
'src/**/*',
8+
// Exclude the following:
9+
'!src/*.html', // html files are handled by html task
10+
'!src/{js,js/**}', // scripts are handled by scripts task
11+
'!src/{img,img/**}', // handled by image task
12+
'!src/{scss,scss/**}', // handled by styles task
13+
])
14+
.pipe(gulp.dest(global.destination));
15+
return staticAssets;
16+
});

gulp/tasks/development.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
'use strict';
2+
3+
var gulp = require('gulp');
4+
var runSequence = require('run-sequence');
5+
6+
gulp.task('dev', function(cb) {
7+
global.mode = 'dev';
8+
global.destination = 'dev';
9+
runSequence('clean', ['styles', 'scsslint', 'scripts', 'jshints', 'copy'], 'watch', cb);
10+
});

gulp/tasks/jshints.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
'use strict';
2+
3+
var gulp = require('gulp'),
4+
jshint = require('gulp-jshint'),
5+
stylish = require('jshint-stylish'),
6+
handleErrors = require('../util/handleErrors');
7+
8+
gulp.task('jshints',function(){
9+
return gulp.src(['src/js/**/*.js', '!src/js/vendor/**/*.js'])
10+
.pipe(jshint())
11+
.pipe(jshint.reporter(stylish))
12+
});

gulp/tasks/production.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
'use strict';
2+
3+
var gulp = require('gulp');
4+
var runSequence = require('run-sequence');
5+
6+
gulp.task('prod', function(cb) {
7+
8+
global.mode = 'prod';
9+
global.destination = 'dist';
10+
runSequence('clean', 'styles', ['scripts', 'copy'], cb);
11+
});

gulp/tasks/scripts.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
'use strict';
2+
3+
var gulp = require('gulp'),
4+
uglify = require('gulp-uglify'),
5+
gulpif = require('gulp-if'),
6+
replace = require('gulp-replace'),
7+
jshint = require('gulp-jshint'),
8+
stylish = require('jshint-stylish'),
9+
handleErrors = require('../util/handleErrors');
10+
11+
gulp.task('scripts', function() {
12+
return gulp.src(['src/js/**/*.js'])
13+
.pipe(gulpif(global.mode !== 'dev',uglify()))
14+
.on('error', handleErrors)
15+
.pipe(gulp.dest(global.destination + '/js'));
16+
});

gulp/tasks/scsslint.js

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
'use strict';
2+
3+
var gulp = require('gulp'),
4+
sass = require('gulp-sass'),
5+
sassLint = require('gulp-sass-lint'),
6+
handleErrors = require('../util/handleErrors');
7+
8+
gulp.task('scsslint', function () {
9+
10+
return gulp.src(['src/scss/**/*.scss','!src/scss/vendor/**/*.scss','!src/scss/_mixins.scss'])
11+
.pipe(sassLint({
12+
options:{
13+
formatter: 'stylish'
14+
},
15+
configFile: '.sass-lint.yml'
16+
}))
17+
.pipe(sassLint.format())
18+
.on('error', handleErrors);
19+
});

gulp/tasks/styles.js

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
'use strict';
2+
3+
var gulp = require('gulp'),
4+
sass = require('gulp-sass'),
5+
sassLint = require('gulp-sass-lint'),
6+
autoprefixer = require('gulp-autoprefixer'),
7+
gulpif = require('gulp-if'),
8+
handleErrors = require('../util/handleErrors');
9+
10+
gulp.task('styles', function () {
11+
12+
return gulp.src(['src/scss/**/*.scss','!src/scss/vendor/**.*.scss'])
13+
.pipe( sass({
14+
sourceComments: (global.mode === 'dev') ? true : false,
15+
outputStyle: (global.mode === 'dev') ? 'nested': 'compressed',
16+
errLogToConsole: true
17+
}))
18+
.on('error', handleErrors)
19+
.pipe(autoprefixer({
20+
browsers: ['last 2 versions', '> 1%', 'ie 9', 'ie 10']
21+
}))
22+
.pipe( gulp.dest(global.destination + '/css'));
23+
});

gulp/tasks/watch.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
'use strict';
2+
3+
var gulp = require('gulp');
4+
5+
gulp.task('watch', function() {
6+
gulp.watch('src/*.html', ['html']);
7+
gulp.watch('src/scss/**/*.scss', ['styles','scsslint']);
8+
gulp.watch('src/img/**/*', ['images']);
9+
gulp.watch('src/js/**/*.js', ['scripts','jshints']);
10+
});

gulp/util/fileType.js

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
'use strict';
2+
3+
var path = require('path');
4+
5+
/**
6+
* Filters out files that don't match the extension. Prevents
7+
* accidental inclusion of possible hidden files.
8+
*
9+
* Usage:
10+
* var fileType = require('fileType');
11+
* fs.readdirSync('some/dir/js/').filter(fileType('js'));
12+
*
13+
* Or
14+
* var onlyScripts = require('fileType')('js');
15+
* fs.readdirSync('some/dir/js/').filter(onlyScripts);
16+
*/
17+
module.exports = function(extension) {
18+
var pattern = new RegExp("(\.(" + extension + ")$)", "i");
19+
return function(name) {
20+
return pattern.test(path.extname(name));
21+
}
22+
};

gulp/util/handleErrors.js

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
'use strict';
2+
3+
var notify = require('gulp-notify');
4+
5+
module.exports = function(error) {
6+
7+
if( global.mode === 'dev' ) {
8+
9+
var args = Array.prototype.slice.call(arguments);
10+
11+
// Send error to notification center with gulp-notify
12+
notify.onError({
13+
title: 'Build Error',
14+
message: error.message
15+
}).apply(this, args);
16+
17+
// Keep gulp from hanging on this task
18+
this.emit('end');
19+
20+
} else {
21+
// Log the error and stop the process
22+
// to prevent broken code from building
23+
console.log(error);
24+
process.exit(1);
25+
}
26+
27+
};

gulpfile.js

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
'use strict';
2+
3+
/*
4+
* gulpfile.js
5+
* ===========
6+
* Rather than manage one giant configuration file responsible
7+
* for creating multiple tasks, each task has been broken out into
8+
* its own file in gulp/tasks. Any file in that folder gets automatically
9+
* required by the loop in ./gulp/index.js (required below).
10+
*
11+
* To add a new task, simply add a new task file to gulp/tasks.
12+
*
13+
* Modified upon https://github.com/brad426/web-app-boilerplate which was
14+
* heavily inspired by the gulp build for
15+
* https://github.com/jakemmarsh/angularjs-gulp-browserify-boilerplate
16+
*
17+
*/
18+
var fs = require('fs'),
19+
onlyScripts = require('./gulp/util/fileType')('js'),
20+
tasks = fs.readdirSync('./gulp/tasks/').filter(onlyScripts);
21+
22+
global.isProd = false;
23+
global.stipWildcard = /\/\*\*.*$/ig;
24+
25+
tasks.forEach(function(task) {
26+
require('./gulp/tasks/' + task);
27+
});

package.json

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
{
2+
"name": "css-parallax",
3+
"version": "0.0.1",
4+
"description": "A super simple parallax plugin",
5+
"main": "readme.md",
6+
"scripts": {
7+
"start": "npm install && gulp dev",
8+
"test": "echo \"Error: no test specified\" && exit 1",
9+
"build": "npm prod"
10+
},
11+
"repository": {
12+
"type": "git",
13+
"url": "https://github.com/ManeeshChiba/css-parallax.git"
14+
},
15+
"keywords": [
16+
"parallax",
17+
"css",
18+
"custom",
19+
"properties",
20+
"css",
21+
"transforms"
22+
],
23+
"author": "Maneesh Chiba",
24+
"devDependencies": {
25+
"del": "^2.2.0",
26+
"gulp": "^3.9.0",
27+
"gulp-autoprefixer": "^3.1.0",
28+
"gulp-concat": "^2.6.0",
29+
"gulp-if": "^2.0.0",
30+
"gulp-jshint": "^2.0.4",
31+
"gulp-notify": "^2.2.0",
32+
"gulp-replace": "^0.5.4",
33+
"gulp-sass": "^3.1.0",
34+
"gulp-sass-lint": "^1.3.2",
35+
"gulp-sourcemaps": "^1.6.0",
36+
"gulp-uglify": "^1.5.1",
37+
"gulp-util": "^3.0.7",
38+
"jshint": "^2.9.2",
39+
"jshint-stylish": "^2.2.0",
40+
"lodash.assign": "^4.0.6",
41+
"merge-stream": "^1.0.0",
42+
"path": "^0.12.7",
43+
"run-sequence": "^2.2.0"
44+
},
45+
"license": "MIT",
46+
"bugs": {
47+
"url": "https://github.com/ManeeshChiba/css-parallax/issues"
48+
},
49+
"homepage": "https://github.com/ManeeshChiba/css-parallax"
50+
}

0 commit comments

Comments
 (0)