diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..0510b82 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,17 @@ + +# EditorConfig is awesome: http://EditorConfig.org + +# top-most EditorConfig file +root = true + +# Unix-style newlines with a newline ending every file +[*] +end_of_line = lf +insert_final_newline = false +indent_style = tab +indent_size = 2 + +# Matches the exact files either package.json or .travis.yml +[{package.json}] +indent_style = space +indent_size = 2 diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..890cfa8 --- /dev/null +++ b/.gitignore @@ -0,0 +1,4 @@ +.DS_Store +node_modules +npm-debug.log +dist diff --git a/.jshintrc b/.jshintrc new file mode 100644 index 0000000..d87f42d --- /dev/null +++ b/.jshintrc @@ -0,0 +1,29 @@ +{ + "bitwise" : false, + "camelcase" : false, + "curly" : false, + "eqeqeq" : true, + "es3" : false, + "forin" : true, + "freeze" : true, + "immed" : true, + "indent" : 2, + "latedef" : "nofunc", + "newcap" : false, + "noarg" : true, + "nonbsp" : true, + "nonew" : true, + "plusplus" : false, + "undef" : true, + "unused" : true, + "strict" : false, + "globalstrict" : true, + "trailing" : true, + "lastsemic" : true, + "proto" : true, + "devel" : true, + "node" : true, + "browserify" : true, + "esnext" : true, + "asi" : true +} \ No newline at end of file diff --git a/.npmignore b/.npmignore new file mode 100644 index 0000000..1b2f5f8 --- /dev/null +++ b/.npmignore @@ -0,0 +1,3 @@ +.DS_Store +.git +npm-debug.log diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..0bdd79a --- /dev/null +++ b/LICENSE @@ -0,0 +1,22 @@ +The MIT License (MIT) + +Copyright (c) 2015 CodingAlchemy + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + diff --git a/README.md b/README.md new file mode 100644 index 0000000..cf8c001 --- /dev/null +++ b/README.md @@ -0,0 +1,7 @@ +```bash + +$ git clone https://github.com/vinspee/projectologist.git +$ cd projectologist +$ npm i +$ npm start +``` diff --git a/app/html/index.html b/app/html/index.html new file mode 100644 index 0000000..f63e696 --- /dev/null +++ b/app/html/index.html @@ -0,0 +1,3 @@ +partials/header.html +fufr +partials/footer.html diff --git a/app/html/partials/footer.html b/app/html/partials/footer.html new file mode 100644 index 0000000..466cb68 --- /dev/null +++ b/app/html/partials/footer.html @@ -0,0 +1,3 @@ + + + diff --git a/app/html/partials/header.html b/app/html/partials/header.html new file mode 100644 index 0000000..3b7eeee --- /dev/null +++ b/app/html/partials/header.html @@ -0,0 +1,11 @@ + + + + + + + Projectologist + + + + diff --git a/app/scripts/app.js b/app/scripts/app.js new file mode 100644 index 0000000..d377c00 --- /dev/null +++ b/app/scripts/app.js @@ -0,0 +1 @@ +//var React = require('react'); diff --git a/app/styles/main.css b/app/styles/main.css new file mode 100644 index 0000000..f36f6b8 --- /dev/null +++ b/app/styles/main.css @@ -0,0 +1,9 @@ +@import "dude"; + +:root { + --red: red; +} + +html { + background: var(--red); +} diff --git a/build/index.js b/build/index.js new file mode 100644 index 0000000..74395e9 --- /dev/null +++ b/build/index.js @@ -0,0 +1,46 @@ +var chron = require('chronic'); +var paths = require('./paths'); + +var cssmin = require('./transforms/cssmin'); +var del = require('./transforms/del'); +var scripts = require('./transforms/scripts'); +var html = require('./transforms/html'); +var serve = require('./transforms/serve'); +var minify = require('./transforms/minify'); +var styles = require('./transforms/styles'); +var icons = require('./transforms/icons'); + +chron('assemble', chron.once('html', 'styles', 'images', 'icons', 'scripts')); +chron('default', chron.once('clean', 'assemble'), serve); +chron('serve', serve); + +chron('html', chron + .path(paths.src.main_html).watch(paths.src.html).watch(paths.src.main_html) + .dest(paths.dest.html), +html) + +chron('styles', chron + .path(paths.src.main_style) + .dest(paths.dest.styles) + .watch(paths.src.styles), +styles); + +chron('clean', chron + .src(paths.dest.html), // same as .path (if used as first option) +del); + +chron('scripts', chron + .path(paths.src.main_script, 'app.js') + .watch(paths.src.scripts) + .dest(paths.dest.scripts), +scripts); + +chron('images', chron + .path(paths.src.images) + .dest(paths.dest.images), +minify.images); + +chron('icons', chron + .path(paths.src.icons) + .dest(paths.dest.images), +icons); diff --git a/build/paths.js b/build/paths.js new file mode 100644 index 0000000..9c57ee4 --- /dev/null +++ b/build/paths.js @@ -0,0 +1,18 @@ +module.exports = { + src: { + images: './app/images/*.{png,jpg,gif,svg,webp}', + icons: './app/images/icons/**/*.svg', + styles: './app/styles/**/*.css', + main_style: './app/styles/main.css', + scripts: './app/scripts/**/*.{js,jsx}', + main_script: './app/scripts/app.js', + html: './app/html/*/**/*.html', + main_html: './app/html/*.html' + }, + dest: { + images: './dist/images', + styles: './dist/styles', + scripts: './dist/scripts', + html: './dist' + } +} diff --git a/build/transforms/build.js b/build/transforms/build.js new file mode 100644 index 0000000..5db097b --- /dev/null +++ b/build/transforms/build.js @@ -0,0 +1,18 @@ +var paths = require('../paths'); + +module.exports = function(t) { + if (t.params.watch) { + browserSync({ + notify: true, + logPrefix: 'PJT', + server: { + baseDir: paths.dest.html, + index: "index.html" + }, + port: 1337, + open: false + }); + } + t.done(); +} + diff --git a/build/transforms/cssmin.js b/build/transforms/cssmin.js new file mode 100644 index 0000000..ca8e9d9 --- /dev/null +++ b/build/transforms/cssmin.js @@ -0,0 +1,17 @@ +var gutil = require('gulp-util') +var uncss = require('gulp-uncss'); +var concat = require('gulp-concat'); +var csso = require('gulp-csso'); + +module.exports = function(t) { + t.eos( + t.src() + //.pipe(uncss({ + //html: ['./views/index.ejs'] + //})) + //.on('error', gutil.log) + .pipe(concat('main.min.css')) + .pipe(csso()) + .pipe(t.dest()) + ); +}; diff --git a/build/transforms/del.js b/build/transforms/del.js new file mode 100644 index 0000000..cdbf573 --- /dev/null +++ b/build/transforms/del.js @@ -0,0 +1,7 @@ +var del = require('del'); + +module.exports = function(t) { + del(t.path, function(err) { + t.done(err); + }); +}; \ No newline at end of file diff --git a/build/transforms/html.js b/build/transforms/html.js new file mode 100644 index 0000000..937b1d7 --- /dev/null +++ b/build/transforms/html.js @@ -0,0 +1,10 @@ +var htmlInclude = require('gulp-html-tag-include'); +var reload = require('browser-sync').reload; + +module.exports = function (t) { + var dest = t.dest(); + if (t.params.watch) { + dest.pipe(reload({stream: true})); + } + t.build(t.src(), htmlInclude(), dest); +}; diff --git a/build/transforms/icons.js b/build/transforms/icons.js new file mode 100644 index 0000000..ed87e66 --- /dev/null +++ b/build/transforms/icons.js @@ -0,0 +1,19 @@ +var svgIcons = require('gulp-svgstore'); +var reload = require('browser-sync').reload; +var cheerio = require('gulp-cheerio'); + +module.exports = function (t) { + var dest = t.dest(); + if (t.params.watch) { + dest.pipe(reload({stream: true})); + } + t.build(t.src(), + cheerio({ + run: function($) { + $('[fill]').removeAttr('fill'); + } + }), + svgIcons({ fileName: 'icons.svg' }), + dest); +}; + diff --git a/build/transforms/minify.js b/build/transforms/minify.js new file mode 100644 index 0000000..ffef8db --- /dev/null +++ b/build/transforms/minify.js @@ -0,0 +1,30 @@ +var concat = require('gulp-concat'); + +module.exports = { + scripts: function(t) { + var uglify = require('gulp-uglify'); + t.build(t.src(), uglify(),concat('app.min.js'), t.dest()); + }, + images: function(t) { + var imagemin = require('gulp-imagemin'); + t.build(t.src(), + imagemin({ + progressive: true, + optimizationLevel: 5, + svgoPlugins: [{ removeViewBox: false }, { removeEmptyAttrs: false }] + }), + t.dest()); + }, + styles: function(t) { + var gutil = require('gulp-util') + var uncss = require('gulp-uncss'); + var csso = require('gulp-csso'); + t.eos( + t.src() + .pipe(concat('main.min.css')) + .pipe(csso()) + .on('error', gutil.log) + .pipe(t.dest()) + ); + } +}; diff --git a/build/transforms/prebundle.js b/build/transforms/prebundle.js new file mode 100644 index 0000000..a60a5c5 --- /dev/null +++ b/build/transforms/prebundle.js @@ -0,0 +1,16 @@ +var derequire = require('gulp-derequire'); +var gutil = require('gulp-util'); +var browserify = require('browserify'); + +module.exports = function(t) { + var b = browserify(); + b.transform('envify'); + b.require(t.path); + t.eos( + b.bundle() + .on('error',gutil.log) + .pipe(t.source('prebundle.js')) + .pipe(derequire()) + .pipe(t.dest()) + ); +}; \ No newline at end of file diff --git a/build/transforms/scripts.js b/build/transforms/scripts.js new file mode 100644 index 0000000..6b18b89 --- /dev/null +++ b/build/transforms/scripts.js @@ -0,0 +1,19 @@ +var browserify = require('browserify'); +var reload = require('browser-sync').reload; + +module.exports = function(t) { + var b = browserify({debug: true}); + b.add(t.path[0]); + b.transform('reactify'); + var bundle = b.bundle().on('error', console.log); + var source = t.source(t.path[1]); + var dest = t.dest(); + if (t.params.watch) { + dest.pipe(reload({stream: true})); + } + t.build(bundle, source, dest); + + // helps sometimes + // console.log(t.path); + // console.log(t.params); +}; diff --git a/build/transforms/serve.js b/build/transforms/serve.js new file mode 100644 index 0000000..f36e651 --- /dev/null +++ b/build/transforms/serve.js @@ -0,0 +1,17 @@ +module.exports = function(t) { + var paths = require('../paths'); + if (t.params.watch) { + var browserSync = require('browser-sync'); + browserSync({ + notify: true, + logPrefix: 'PJT', + server: { + baseDir: paths.dest.html, + index: "index.html" + }, + port: 1337, + open: false + }); + } + t.done(); +} diff --git a/build/transforms/styles.js b/build/transforms/styles.js new file mode 100644 index 0000000..00c032f --- /dev/null +++ b/build/transforms/styles.js @@ -0,0 +1,43 @@ +var gutil = require('gulp-util'); +var postcss = require('gulp-postcss'); +var reload = require('browser-sync').reload; +var sourcemaps = require('gulp-sourcemaps'); +var autoprefixer = require('autoprefixer-core'); +var calc = require('postcss-calc'); +var colorFunction = require('postcss-color-function'); +var gray = require('postcss-color-gray'); +var colorHexAlpha = require('postcss-color-hex-alpha'); +var customMedia = require('postcss-custom-media'); +var customProperties = require('postcss-custom-properties'); +var fontVariant = require('postcss-font-variant'); +var inline = require('postcss-import'); +var nested = require('postcss-nested'); +var mincss = require('./cssmin'); + +module.exports = function(t) { + var dest = t.dest(); + if (t.params.watch) { + dest.pipe(reload({stream: true})); + } + if (t.params.production) { + dest.pipe(mincss(t)); + } + t.build(t.src(), + sourcemaps.init(), + postcss([ + inline({ + path: ['app/styles/'] + }), + nested, + customProperties(), + calc(), + customMedia(), + gray(), + colorHexAlpha(), + colorFunction(), + fontVariant(), + autoprefixer({ browsers: 'last 2 versions' }) + ]), + sourcemaps.write('.'), + dest); +}; diff --git a/package.json b/package.json new file mode 100644 index 0000000..d7cff23 --- /dev/null +++ b/package.json @@ -0,0 +1,62 @@ +{ + "name": "projectologist", + "version": "4.0.0-beta", + "description": "He takes care of your shit for you.", + "repository": "vinspee/projectologist", + "main": "build", + "author": "vinspee", + "devDependencies": { + "autoprefixer-core": "^4.0.2", + "browser-sync": "^1.9.0", + "browserify": "8.1.0", + "bundle-collapser": "^1.1.1", + "cheerio": "^0.18.0", + "chronic": "0.2.6", + "core-js": "0.4.4", + "del": "1.1.1", + "envify": "^3.2.0", + "gulp-autoprefixer": "2.1.0", + "gulp-cheerio": "^0.5.1", + "gulp-csso": "0.2.9", + "gulp-derequire": "2.0.0", + "gulp-ext": "1.0.0", + "gulp-html-tag-include": "0.0.9", + "gulp-imagemin": "2.1.0", + "gulp-postcss": "^3.0.0", + "gulp-sourcemaps": "^1.3.0", + "gulp-svgstore": "^4.0.1", + "gulp-tap": "0.1.3", + "gulp-uglify": "1.0.2", + "gulp-uncss": "0.5.2", + "gulp-util": "^3.0.2", + "once": "1.3.1", + "postcss-calc": "^3.0.0", + "postcss-color-function": "^1.1.0", + "postcss-color-gray": "^1.1.0", + "postcss-color-hex-alpha": "^1.1.0", + "postcss-custom-media": "^1.3.0", + "postcss-custom-properties": "^2.1.1", + "postcss-font-variant": "^1.0.1", + "postcss-import": "^4.1.1", + "postcss-nested": "^0.1.0", + "react": "^0.12.2", + "reactify": "^0.17.1" + }, + "dependencies": {}, + "publishConfig": { + "registry": "https://registry.npmjs.org" + }, + "scripts": { + "test": "mocha", + "start": "node build clean html styles images icons scripts serve -w" + }, + "homepage": "https://github.com/vinspee/projectologist", + "bugs": { + "url": "https://github.com/vinspee/projectologist/issues" + }, + "keywords": [ + "scaffold", + "front end" + ], + "license": "MIT" +}