Permalink
Browse files

First library serious commit

  • Loading branch information...
1 parent 01c5e5e commit 7892707076c10312004c953fd7f24e4e233985de @Riccardo-Zanutta committed Apr 12, 2016
View
@@ -0,0 +1,3 @@
+{
+ "presets": ["es2015"]
+}
View
@@ -0,0 +1,13 @@
+# editorconfig.org
+
+root = true
+
+[*]
+charset = utf-8
+indent_size = 2
+indent_style = space
+insert_final_newline = true
+trim_trailing_whitespace = true
+
+[*.md]
+trim_trailing_whitespace = false
View
@@ -0,0 +1,3 @@
+{
+ "extends": "airbnb/base"
+}
View
@@ -1,33 +1,40 @@
-# Logs
-logs
-*.log
+# See https://help.github.com/articles/ignoring-files for more about ignoring files.
+#
+# If you find yourself ignoring temporary files generated by your text editor
+# or operating system, you probably want to add a global ignore instead:
+# git config --global core.excludesfile '~/.gitignore_global'
+
+# Ignore OS-related files
+.DS_Store
+Thumbs.db
+Desktop.ini
+
+# Node Related
+node_modules/
npm-debug.log*
-# Runtime data
-pids
-*.pid
-*.seed
-
-# Directory for instrumented libs generated by jscoverage/JSCover
-lib-cov
-
-# Coverage directory used by tools like istanbul
-coverage
+# Maps
+*.css.map
+*.js.map
-# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
-.grunt
+# dist folder
+dist
-# node-waf configuration
-.lock-wscript
+# Original img folder
+src/img/original
-# Compiled binary addons (http://nodejs.org/api/addons.html)
-build/Release
+# Editors
+.idea
+.project
-# Dependency directory
-node_modules
-
-# Optional npm cache directory
-.npm
-
-# Optional REPL history
-.node_repl_history
+# Misc
+*.csv
+*.dat
+*.iml
+*.log
+*.out
+*.pid
+*.seed
+*.sublime-*
+*.swo
+*.swp
View
@@ -1,2 +1,24 @@
-# brick
-A solid, modern, not-so-opinionated front-end boilerplate.
+# BRick - A solid, modern, not-so-opinionated boilerplate. #
+
+**Development guide**
+
+```sh
+# Clone this repository
+$ git clone https://github.com/Riccardo-Zanutta/brick.git new_project
+$ cd new_project
+
+# Install dependencies
+$ npm install
+# Run tasks and serve
+$ gulp
+```
+
+You'll have everything up & running(the browser is automatically open and ready for live-reload development).
+
+### Additional infos
+* Modify the package.json and config.json with your variables/config
+
+```sh
+# You can view all of your available tasks with:
+$ gulp help
+```
View
@@ -0,0 +1,18 @@
+{
+ "port": "4001",
+ "src_folder": ["./src/**/*", "!./src/img/original"],
+ "dist_folder": "./dist/",
+ "del_folder": "./dist",
+ "html_src": "./src/*.html",
+ "html_dest": "./src",
+ "sass_src": "./src/css/**/*.scss",
+ "sass_dest": "./src/css",
+ "autoprefixer_options": {
+ "browsers": ["last 3 versions", "ie >= 9", "and_chr >= 2.3"]
+ },
+ "js_src": ["./src/js/vendor/**/*.js", "./src/js/build/**/*.js"],
+ "js_file_name": "application.js",
+ "js_dest": "./src/js",
+ "img_src": "./src/img/original/*",
+ "img_dest": "./src/img/"
+}
View
@@ -0,0 +1,102 @@
+/**
+ * BRick
+ * https://github.com/Riccardo-Zanutta/brick
+ * Copyright 2016 Riccardo Zanutta (@RiccardoZanutta)
+ * Released under the MIT license (http://mit-license.org)
+*/
+
+'use strict';
+
+import gulp from 'gulp';
+import config from './config.json';
+import pkg from './package.json';
+import gulpLoadPlugins from 'gulp-load-plugins';
+import browserSync from 'browser-sync';
+import del from 'del';
+import runSequence from 'run-sequence';
+import { argv } from 'yargs';
+
+const $ = gulpLoadPlugins();
+const reload = browserSync.reload;
+
+// List all tasks and subtasks
+gulp.task('help', $.taskListing);
+
+// Sass compile, autprefixer, minify, sourcemaps
+gulp.task('styles', () => {
+ return gulp.src(config.sass_src)
+ .pipe($.if(argv.pretty, $.sourcemaps.init()))
+ .pipe($.sass({
+ precision: 10
+ }).on('error', $.sass.logError))
+ .pipe($.autoprefixer(config.autoprefixer_options))
+ .pipe($.if(!argv.pretty, $.cssnano()))
+ .pipe($.size({title: 'Styles'}))
+ .pipe($.if(argv.pretty, $.sourcemaps.write('./')))
+ .pipe(gulp.dest(config.sass_dest))
+});
+
+// Lint my js (airbnb stylguide)
+gulp.task('lint', () => {
+ gulp.src(config.js_src)
+ .pipe($.eslint())
+ .pipe($.eslint.format())
+ .pipe($.if(!browserSync.active, $.eslint.failOnError()))
+});
+
+// Concat, sourcemaps and minify js files
+gulp.task('scripts', () => {
+ gulp.src(config.js_src)
+ .pipe($.if(argv.pretty, $.sourcemaps.init()))
+ .pipe($.babel())
+ .pipe($.concat(config.js_file_name))
+ .pipe($.if(!argv.pretty, $.uglify({preserveComments: 'some'})))
+ .pipe($.if(argv.pretty, $.sourcemaps.write('.')))
+ .pipe($.size({title: 'Scripts'}))
+ .pipe(gulp.dest(config.js_dest))
+});
+
+// Clean the dist/ folder
+gulp.task('clean', () => del(config.del_folder, {dot: true}));
+
+// Copy the content from the src/ folder to the dist/ one
+gulp.task('copy', ['clean'], () => {
+ return gulp.src(config.src_folder)
+ .pipe(gulp.dest(config.dist_folder))
+});
+
+// Serve the content, live reload with browsersync
+gulp.task('serve', ['styles', 'lint', 'scripts'], () => {
+ let serverDir = !argv.pretty ? './dist' : './src';
+ browserSync.init({
+ notify: false,
+ server: {
+ baseDir: serverDir
+ },
+ port: config.port
+ });
+
+ gulp.watch([`${serverDir}/**/*.html`], [reload]);
+ gulp.watch([`${serverDir}/css/**/*.scss`], ['styles', reload]);
+ gulp.watch([`${serverDir}/js/vendor/**/*.js`, `./${serverDir}/js/build/**/*.js`], ['lint', 'scripts', reload]);
+ gulp.watch([`${serverDir}/img/**/*`], reload);
+});
+
+gulp.task('production', () => {
+ runSequence(
+ 'styles',
+ ['lint', 'scripts'],
+ 'copy'
+ );
+});
+
+// This is the default task :)
+gulp.task('default', ['clean'], () => {
+ const startTime = Date.now();
+ runSequence('serve', () => {
+ console.log('\x1b[42m************************************\x1b[0m\n');
+ console.log('\x1b[32m BRick is ready to Rock!\x1b[0m\n');
+ console.log('\x1b[42m************************************\x1b[0m\n');
+ console.log('[\x1b[32mBRick\x1b[0m]', `All finished in \x1b[35m${Date.now() - startTime} ms` ,'\x1b[0m\n');
+ })
+});
View
@@ -0,0 +1,48 @@
+{
+ "name": "brick",
+ "version": "1.0.0",
+ "description": "A solid, modern, not-so-opinionated front-end boilerplate.",
+ "main": "gulpfile.babel.js",
+ "scripts": {
+ "start": "gulp --pretty",
+ "dist": "gulp production"
+ },
+ "repository": {
+ "type": "git",
+ "url": "git+https://github.com/Riccardo-Zanutta/brick.git"
+ },
+ "keywords": [
+ "front-end",
+ "boilerplate"
+ ],
+ "author": "Riccardo Zanutta",
+ "license": "MIT",
+ "homepage": "",
+ "devDependencies": {
+ "babel-core": "^6.7.2",
+ "babel-preset-es2015": "^6.6.0",
+ "babel-register": "^6.7.2",
+ "browser-sync": "^2.11.1",
+ "del": "^2.2.0",
+ "eslint": "^2.4.0",
+ "eslint-config-airbnb": "^6.1.0",
+ "eslint-plugin-react": "^4.2.3",
+ "gulp": "^3.9.1",
+ "gulp-autoprefixer": "^3.1.0",
+ "gulp-babel": "^6.1.2",
+ "gulp-concat": "^2.6.0",
+ "gulp-cssnano": "^2.1.1",
+ "gulp-eslint": "^2.0.0",
+ "gulp-htmlmin": "^1.3.0",
+ "gulp-if": "^2.0.0",
+ "gulp-load-plugins": "^1.2.0",
+ "gulp-sass": "^2.2.0",
+ "gulp-size": "^2.1.0",
+ "gulp-sourcemaps": "^1.6.0",
+ "gulp-task-listing": "^1.0.1",
+ "gulp-uglify": "^1.5.3",
+ "gulp-util": "^3.0.7",
+ "run-sequence": "^1.1.5",
+ "yargs": "^4.3.2"
+ }
+}
Oops, something went wrong.

0 comments on commit 7892707

Please sign in to comment.