Skip to content

inital commit #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 11, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions docs/.babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@

{
"presets": ["es2015"],
"plugins": [["add-module-exports"]]
}
13 changes: 13 additions & 0 deletions docs/.editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# http://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
31 changes: 31 additions & 0 deletions docs/.eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
{
"parser": "babel-eslint",
"env": {
"browser": true,
"node": true,
"es6": true
},
"globals": {
"DocumentFragment": true
},
"rules": {
"indent": [2, 2],
"valid-jsdoc": 0,
"brace-style": [1, "stroustrup"],
"no-constant-condition": 1,
"no-underscore-dangle": 0,
"no-use-before-define": 1,
"func-names": 0,
"semi": [2, "always"],
"no-new": 0,
"new-parens": 2,
"no-ternary": 0,
"new-cap": 0,
"no-unused-vars": [1, {"vars": "local", "args": "none"}],
"quotes": [2, "single"],
"one-var": 0,
"space-infix-ops": 0,
"strict": 0,
"camelcase": [2, {"properties": "never"}]
}
}
1 change: 1 addition & 0 deletions docs/.gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* text=auto
6 changes: 6 additions & 0 deletions docs/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
node_modules
*.log
build
tmp
.grunt
.DS_Store
12 changes: 12 additions & 0 deletions docs/.yo-rc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"generator-yeogurt": {
"config": {
"projectName": "Pure-css-components",
"htmlOption": "jade",
"jsPreprocessor": "es6",
"cssOption": "less",
"testFramework": "none"
},
"version": "1.5.3"
}
}
54 changes: 54 additions & 0 deletions docs/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
# Pure-Css-Components readme

Generated on 2016-09-11 using
[generator-yeogurt@1.5.3](https://github.com/larsonjj/generator-yeogurt)

## Description

This is an example readme file.
Describe your site/app here.

## Technologies used

JavaScript
- [Browserify](http://browserify.org/) with ES6/2015 support through [Babel](https://babeljs.io/)
- [Node](https://nodejs.org/)

Styles
- [Less](http://lesscss.org/)

Markup
- [Jade](http://jade-lang.com/)

Optimization
- [Imagemin](https://github.com/imagemin/imagemin)
- [Uglify](https://github.com/mishoo/UglifyJS)

Server
- [BrowserSync](http://www.browsersync.io/)

Linting
- [ESlint](http://eslint.org/)

Automation
- [Gulp](http://gulpjs.com)

Code Management
- [Editorconfig](http://editorconfig.org/)
- [Git](https://git-scm.com/)


## Automated tasks

This project uses [Gulp](http://gulpjs.com) to run automated tasks for development and production builds.
The tasks are as follows:

`gulp --production`: Same as `gulp serve --production` also run `gulp test` and not boot up production server

`gulp serve`: Compiles preprocessors and boots up development server
`gulp serve --open`: Same as `gulp serve` but will also open up site/app in your default browser
`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

`gulp test`: Lints all `*.js` file in the `source` folder using eslint

***Adding the `--debug` option to any gulp task displays extra debugging information (ex. data being loaded into your templates)***
23 changes: 23 additions & 0 deletions docs/gulp/browserSync.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
'use strict';

export default function(gulp, plugins, args, config, taskTarget, browserSync) {
// BrowserSync
gulp.task('browserSync', () => {
browserSync.init({
open: args.open ? 'local' : false,
startPath: config.baseUrl,
port: config.port || 3000,
server: {
baseDir: taskTarget,
routes: (() => {
let routes = {};

// Map base URL to routes
routes[config.baseUrl] = taskTarget;

return routes;
})()
}
});
});
}
94 changes: 94 additions & 0 deletions docs/gulp/browserify.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
'use strict';

import path from 'path';
import glob from 'glob';
import browserify from 'browserify';
import watchify from 'watchify';
import envify from 'envify';
import babelify from 'babelify';
import _ from 'lodash';
import vsource from 'vinyl-source-stream';
import buffer from 'vinyl-buffer';
import gulpif from 'gulp-if';

export default function(gulp, plugins, args, config, taskTarget, browserSync) {
let dirs = config.directories;
let entries = config.entries;

let browserifyTask = (files) => {
return files.map((entry) => {
let dest = path.resolve(taskTarget);

// Options
let customOpts = {
entries: [entry],
debug: true,
transform: [
babelify, // Enable ES6 features
envify // Sets NODE_ENV for better optimization of npm packages
]
};

let bundler = browserify(customOpts);

if (!args.production) {
// Setup Watchify for faster builds
let opts = _.assign({}, watchify.args, customOpts);
bundler = watchify(browserify(opts));
}

let rebundle = function() {
let startTime = new Date().getTime();
bundler.bundle()
.on('error', function(err) {
plugins.util.log(
plugins.util.colors.red('Browserify compile error:'),
'\n',
err.stack,
'\n'
);
this.emit('end');
})
.on('error', plugins.notify.onError(config.defaultNotification))
.pipe(vsource(entry))
.pipe(buffer())
.pipe(plugins.sourcemaps.init({loadMaps: true}))
.pipe(gulpif(args.production, plugins.uglify()))
.on('error', plugins.notify.onError(config.defaultNotification))
.pipe(plugins.rename(function(filepath) {
// Remove 'source' directory as well as prefixed folder underscores
// Ex: 'src/_scripts' --> '/scripts'
filepath.dirname = filepath.dirname.replace(dirs.source, '').replace('_', '');
}))
.pipe(plugins.sourcemaps.write('./'))
.pipe(gulp.dest(dest))
// Show which file was bundled and how long it took
.on('end', function() {
let time = (new Date().getTime() - startTime) / 1000;
console.log(
plugins.util.colors.cyan(entry)
+ ' was browserified: '
+ plugins.util.colors.magenta(time + 's'));
return browserSync.reload('*.js');
});
};

if (!args.production) {
bundler.on('update', rebundle); // on any dep update, runs the bundler
bundler.on('log', plugins.util.log); // output build logs to terminal
}
return rebundle();
});
};

// Browserify Task
gulp.task('browserify', (done) => {
return glob('./' + path.join(dirs.source, dirs.scripts, entries.js), function(err, files) {
if (err) {
done(err);
}

return browserifyTask(files);
});
});
}
14 changes: 14 additions & 0 deletions docs/gulp/clean.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
'use strict';

import path from 'path';
import del from 'del';

export default function(gulp, plugins, args, config, taskTarget, browserSync) {
let dirs = config.directories;

// Clean
gulp.task('clean', del.bind(null, [
path.join(dirs.temporary),
path.join(dirs.destination)
]));
}
19 changes: 19 additions & 0 deletions docs/gulp/copy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
'use strict';

import path from 'path';

export default function(gulp, plugins, args, config, taskTarget, browserSync) {
let dirs = config.directories;
let dest = path.join(taskTarget);

// Copy
gulp.task('copy', () => {
return gulp.src([
path.join(dirs.source, '**/*'),
'!' + path.join(dirs.source, '{**/\_*,**/\_*/**}'),
'!' + path.join(dirs.source, '**/*.jade')
])
.pipe(plugins.changed(dest))
.pipe(gulp.dest(dest));
});
}
31 changes: 31 additions & 0 deletions docs/gulp/eslint.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
/*eslint no-process-exit:0 */

'use strict';

import path from 'path';
import gulpif from 'gulp-if';

export default function(gulp, plugins, args, config, taskTarget, browserSync) {
let dirs = config.directories;

// ESLint
gulp.task('eslint', () => {
gulp.src([
path.join('gulpfile.js'),
path.join(dirs.source, '**/*.js'),
// Ignore all vendor folder files
'!' + path.join('**/vendor/**', '*')
])
.pipe(browserSync.reload({stream: true, once: true}))
.pipe(plugins.eslint({
useEslintrc: true
}))
.pipe(plugins.eslint.format())
.pipe(gulpif(!browserSync.active, plugins.eslint.failAfterError()))
.on('error', function() {
if (!browserSync.active) {
process.exit(1);
}
});
});
}
22 changes: 22 additions & 0 deletions docs/gulp/imagemin.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
'use strict';

import path from 'path';
import gulpif from 'gulp-if';
import pngquant from 'imagemin-pngquant';

export default function(gulp, plugins, args, config, taskTarget, browserSync) {
let dirs = config.directories;
let dest = path.join(taskTarget, dirs.images.replace(/^_/, ''));

// Imagemin
gulp.task('imagemin', () => {
return gulp.src(path.join(dirs.source, dirs.images, '**/*.{jpg,jpeg,gif,svg,png}'))
.pipe(plugins.changed(dest))
.pipe(gulpif(args.production, plugins.imagemin({
progressive: true,
svgoPlugins: [{removeViewBox: false}],
use: [pngquant({speed: 10})]
})))
.pipe(gulp.dest(dest));
});
}
Loading