Skip to content

Commit edcd4cf

Browse files
authored
Merge pull request #1 from pgalias/docs
inital commit
2 parents 134466b + 0ba3659 commit edcd4cf

35 files changed

+1118
-0
lines changed

docs/.babelrc

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
2+
{
3+
"presets": ["es2015"],
4+
"plugins": [["add-module-exports"]]
5+
}

docs/.editorconfig

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# http://editorconfig.org
2+
root = true
3+
4+
[*]
5+
indent_style = space
6+
indent_size = 2
7+
end_of_line = lf
8+
charset = utf-8
9+
trim_trailing_whitespace = true
10+
insert_final_newline = true
11+
12+
[*.md]
13+
trim_trailing_whitespace = false

docs/.eslintrc

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
{
2+
"parser": "babel-eslint",
3+
"env": {
4+
"browser": true,
5+
"node": true,
6+
"es6": true
7+
},
8+
"globals": {
9+
"DocumentFragment": true
10+
},
11+
"rules": {
12+
"indent": [2, 2],
13+
"valid-jsdoc": 0,
14+
"brace-style": [1, "stroustrup"],
15+
"no-constant-condition": 1,
16+
"no-underscore-dangle": 0,
17+
"no-use-before-define": 1,
18+
"func-names": 0,
19+
"semi": [2, "always"],
20+
"no-new": 0,
21+
"new-parens": 2,
22+
"no-ternary": 0,
23+
"new-cap": 0,
24+
"no-unused-vars": [1, {"vars": "local", "args": "none"}],
25+
"quotes": [2, "single"],
26+
"one-var": 0,
27+
"space-infix-ops": 0,
28+
"strict": 0,
29+
"camelcase": [2, {"properties": "never"}]
30+
}
31+
}

docs/.gitattributes

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
* text=auto

docs/.gitignore

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
node_modules
2+
*.log
3+
build
4+
tmp
5+
.grunt
6+
.DS_Store

docs/.yo-rc.json

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"generator-yeogurt": {
3+
"config": {
4+
"projectName": "Pure-css-components",
5+
"htmlOption": "jade",
6+
"jsPreprocessor": "es6",
7+
"cssOption": "less",
8+
"testFramework": "none"
9+
},
10+
"version": "1.5.3"
11+
}
12+
}

docs/README.md

+54
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
# Pure-Css-Components readme
2+
3+
Generated on 2016-09-11 using
4+
[generator-yeogurt@1.5.3](https://github.com/larsonjj/generator-yeogurt)
5+
6+
## Description
7+
8+
This is an example readme file.
9+
Describe your site/app here.
10+
11+
## Technologies used
12+
13+
JavaScript
14+
- [Browserify](http://browserify.org/) with ES6/2015 support through [Babel](https://babeljs.io/)
15+
- [Node](https://nodejs.org/)
16+
17+
Styles
18+
- [Less](http://lesscss.org/)
19+
20+
Markup
21+
- [Jade](http://jade-lang.com/)
22+
23+
Optimization
24+
- [Imagemin](https://github.com/imagemin/imagemin)
25+
- [Uglify](https://github.com/mishoo/UglifyJS)
26+
27+
Server
28+
- [BrowserSync](http://www.browsersync.io/)
29+
30+
Linting
31+
- [ESlint](http://eslint.org/)
32+
33+
Automation
34+
- [Gulp](http://gulpjs.com)
35+
36+
Code Management
37+
- [Editorconfig](http://editorconfig.org/)
38+
- [Git](https://git-scm.com/)
39+
40+
41+
## Automated tasks
42+
43+
This project uses [Gulp](http://gulpjs.com) to run automated tasks for development and production builds.
44+
The tasks are as follows:
45+
46+
`gulp --production`: Same as `gulp serve --production` also run `gulp test` and not boot up production server
47+
48+
`gulp serve`: Compiles preprocessors and boots up development server
49+
`gulp serve --open`: Same as `gulp serve` but will also open up site/app in your default browser
50+
`gulp serve --production`: Same as `gulp serve` but will run all production tasks so you can view the site/app in it's final optimized form
51+
52+
`gulp test`: Lints all `*.js` file in the `source` folder using eslint
53+
54+
***Adding the `--debug` option to any gulp task displays extra debugging information (ex. data being loaded into your templates)***

docs/gulp/browserSync.js

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
'use strict';
2+
3+
export default function(gulp, plugins, args, config, taskTarget, browserSync) {
4+
// BrowserSync
5+
gulp.task('browserSync', () => {
6+
browserSync.init({
7+
open: args.open ? 'local' : false,
8+
startPath: config.baseUrl,
9+
port: config.port || 3000,
10+
server: {
11+
baseDir: taskTarget,
12+
routes: (() => {
13+
let routes = {};
14+
15+
// Map base URL to routes
16+
routes[config.baseUrl] = taskTarget;
17+
18+
return routes;
19+
})()
20+
}
21+
});
22+
});
23+
}

docs/gulp/browserify.js

+94
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
'use strict';
2+
3+
import path from 'path';
4+
import glob from 'glob';
5+
import browserify from 'browserify';
6+
import watchify from 'watchify';
7+
import envify from 'envify';
8+
import babelify from 'babelify';
9+
import _ from 'lodash';
10+
import vsource from 'vinyl-source-stream';
11+
import buffer from 'vinyl-buffer';
12+
import gulpif from 'gulp-if';
13+
14+
export default function(gulp, plugins, args, config, taskTarget, browserSync) {
15+
let dirs = config.directories;
16+
let entries = config.entries;
17+
18+
let browserifyTask = (files) => {
19+
return files.map((entry) => {
20+
let dest = path.resolve(taskTarget);
21+
22+
// Options
23+
let customOpts = {
24+
entries: [entry],
25+
debug: true,
26+
transform: [
27+
babelify, // Enable ES6 features
28+
envify // Sets NODE_ENV for better optimization of npm packages
29+
]
30+
};
31+
32+
let bundler = browserify(customOpts);
33+
34+
if (!args.production) {
35+
// Setup Watchify for faster builds
36+
let opts = _.assign({}, watchify.args, customOpts);
37+
bundler = watchify(browserify(opts));
38+
}
39+
40+
let rebundle = function() {
41+
let startTime = new Date().getTime();
42+
bundler.bundle()
43+
.on('error', function(err) {
44+
plugins.util.log(
45+
plugins.util.colors.red('Browserify compile error:'),
46+
'\n',
47+
err.stack,
48+
'\n'
49+
);
50+
this.emit('end');
51+
})
52+
.on('error', plugins.notify.onError(config.defaultNotification))
53+
.pipe(vsource(entry))
54+
.pipe(buffer())
55+
.pipe(plugins.sourcemaps.init({loadMaps: true}))
56+
.pipe(gulpif(args.production, plugins.uglify()))
57+
.on('error', plugins.notify.onError(config.defaultNotification))
58+
.pipe(plugins.rename(function(filepath) {
59+
// Remove 'source' directory as well as prefixed folder underscores
60+
// Ex: 'src/_scripts' --> '/scripts'
61+
filepath.dirname = filepath.dirname.replace(dirs.source, '').replace('_', '');
62+
}))
63+
.pipe(plugins.sourcemaps.write('./'))
64+
.pipe(gulp.dest(dest))
65+
// Show which file was bundled and how long it took
66+
.on('end', function() {
67+
let time = (new Date().getTime() - startTime) / 1000;
68+
console.log(
69+
plugins.util.colors.cyan(entry)
70+
+ ' was browserified: '
71+
+ plugins.util.colors.magenta(time + 's'));
72+
return browserSync.reload('*.js');
73+
});
74+
};
75+
76+
if (!args.production) {
77+
bundler.on('update', rebundle); // on any dep update, runs the bundler
78+
bundler.on('log', plugins.util.log); // output build logs to terminal
79+
}
80+
return rebundle();
81+
});
82+
};
83+
84+
// Browserify Task
85+
gulp.task('browserify', (done) => {
86+
return glob('./' + path.join(dirs.source, dirs.scripts, entries.js), function(err, files) {
87+
if (err) {
88+
done(err);
89+
}
90+
91+
return browserifyTask(files);
92+
});
93+
});
94+
}

docs/gulp/clean.js

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
'use strict';
2+
3+
import path from 'path';
4+
import del from 'del';
5+
6+
export default function(gulp, plugins, args, config, taskTarget, browserSync) {
7+
let dirs = config.directories;
8+
9+
// Clean
10+
gulp.task('clean', del.bind(null, [
11+
path.join(dirs.temporary),
12+
path.join(dirs.destination)
13+
]));
14+
}

docs/gulp/copy.js

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
'use strict';
2+
3+
import path from 'path';
4+
5+
export default function(gulp, plugins, args, config, taskTarget, browserSync) {
6+
let dirs = config.directories;
7+
let dest = path.join(taskTarget);
8+
9+
// Copy
10+
gulp.task('copy', () => {
11+
return gulp.src([
12+
path.join(dirs.source, '**/*'),
13+
'!' + path.join(dirs.source, '{**/\_*,**/\_*/**}'),
14+
'!' + path.join(dirs.source, '**/*.jade')
15+
])
16+
.pipe(plugins.changed(dest))
17+
.pipe(gulp.dest(dest));
18+
});
19+
}

docs/gulp/eslint.js

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
/*eslint no-process-exit:0 */
2+
3+
'use strict';
4+
5+
import path from 'path';
6+
import gulpif from 'gulp-if';
7+
8+
export default function(gulp, plugins, args, config, taskTarget, browserSync) {
9+
let dirs = config.directories;
10+
11+
// ESLint
12+
gulp.task('eslint', () => {
13+
gulp.src([
14+
path.join('gulpfile.js'),
15+
path.join(dirs.source, '**/*.js'),
16+
// Ignore all vendor folder files
17+
'!' + path.join('**/vendor/**', '*')
18+
])
19+
.pipe(browserSync.reload({stream: true, once: true}))
20+
.pipe(plugins.eslint({
21+
useEslintrc: true
22+
}))
23+
.pipe(plugins.eslint.format())
24+
.pipe(gulpif(!browserSync.active, plugins.eslint.failAfterError()))
25+
.on('error', function() {
26+
if (!browserSync.active) {
27+
process.exit(1);
28+
}
29+
});
30+
});
31+
}

docs/gulp/imagemin.js

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
'use strict';
2+
3+
import path from 'path';
4+
import gulpif from 'gulp-if';
5+
import pngquant from 'imagemin-pngquant';
6+
7+
export default function(gulp, plugins, args, config, taskTarget, browserSync) {
8+
let dirs = config.directories;
9+
let dest = path.join(taskTarget, dirs.images.replace(/^_/, ''));
10+
11+
// Imagemin
12+
gulp.task('imagemin', () => {
13+
return gulp.src(path.join(dirs.source, dirs.images, '**/*.{jpg,jpeg,gif,svg,png}'))
14+
.pipe(plugins.changed(dest))
15+
.pipe(gulpif(args.production, plugins.imagemin({
16+
progressive: true,
17+
svgoPlugins: [{removeViewBox: false}],
18+
use: [pngquant({speed: 10})]
19+
})))
20+
.pipe(gulp.dest(dest));
21+
});
22+
}

0 commit comments

Comments
 (0)