Skip to content

Commit

Permalink
init
Browse files Browse the repository at this point in the history
  • Loading branch information
VinSpee committed Jan 15, 2015
0 parents commit 774ce9b
Show file tree
Hide file tree
Showing 24 changed files with 431 additions and 0 deletions.
17 changes: 17 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -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
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
.DS_Store
node_modules
npm-debug.log
dist
29 changes: 29 additions & 0 deletions .jshintrc
Original file line number Diff line number Diff line change
@@ -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
}
3 changes: 3 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.DS_Store
.git
npm-debug.log
22 changes: 22 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -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.

7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
```bash

$ git clone https://github.com/vinspee/projectologist.git
$ cd projectologist
$ npm i
$ npm start
```
3 changes: 3 additions & 0 deletions app/html/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<include>partials/header.html</include>
fufr
<include>partials/footer.html</include>
3 changes: 3 additions & 0 deletions app/html/partials/footer.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<script type="text/javascript" src="scripts/app.js"></script>
</body>
</html>
11 changes: 11 additions & 0 deletions app/html/partials/header.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Projectologist</title>
<meta name="description" content="taking care of shit">
<link rel="stylesheet" type="text/css" href="styles/main.css">
</head>
<body>
1 change: 1 addition & 0 deletions app/scripts/app.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
//var React = require('react');
9 changes: 9 additions & 0 deletions app/styles/main.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
@import "dude";

:root {
--red: red;
}

html {
background: var(--red);
}
46 changes: 46 additions & 0 deletions build/index.js
Original file line number Diff line number Diff line change
@@ -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);
18 changes: 18 additions & 0 deletions build/paths.js
Original file line number Diff line number Diff line change
@@ -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'
}
}
18 changes: 18 additions & 0 deletions build/transforms/build.js
Original file line number Diff line number Diff line change
@@ -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();
}

17 changes: 17 additions & 0 deletions build/transforms/cssmin.js
Original file line number Diff line number Diff line change
@@ -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())
);
};
7 changes: 7 additions & 0 deletions build/transforms/del.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
var del = require('del');

module.exports = function(t) {
del(t.path, function(err) {
t.done(err);
});
};
10 changes: 10 additions & 0 deletions build/transforms/html.js
Original file line number Diff line number Diff line change
@@ -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);
};
19 changes: 19 additions & 0 deletions build/transforms/icons.js
Original file line number Diff line number Diff line change
@@ -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);
};

30 changes: 30 additions & 0 deletions build/transforms/minify.js
Original file line number Diff line number Diff line change
@@ -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())
);
}
};
16 changes: 16 additions & 0 deletions build/transforms/prebundle.js
Original file line number Diff line number Diff line change
@@ -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())
);
};
19 changes: 19 additions & 0 deletions build/transforms/scripts.js
Original file line number Diff line number Diff line change
@@ -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);
};
17 changes: 17 additions & 0 deletions build/transforms/serve.js
Original file line number Diff line number Diff line change
@@ -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();
}
43 changes: 43 additions & 0 deletions build/transforms/styles.js
Original file line number Diff line number Diff line change
@@ -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);
};
Loading

0 comments on commit 774ce9b

Please sign in to comment.