Permalink
Browse files

initializing from cloudfour/fabricator

  • Loading branch information...
tylersticka committed May 28, 2015
0 parents commit 1329b2d214b42a6779ef499d20385e9fbb804ef7
Showing with 2,260 additions and 0 deletions.
  1. +3 −0 .babelrc
  2. +17 −0 .editorconfig
  3. +1 −0 .gitattributes
  4. +3 −0 .gitignore
  5. +20 −0 .jshintrc
  6. +12 −0 .travis.yml
  7. +83 −0 README.md
  8. +5 −0 build/helpers/displayName.js
  9. +10 −0 build/helpers/ifEqual.js
  10. +11 −0 build/helpers/moment.js
  11. +184 −0 gulpfile.js
  12. +54 −0 package.json
  13. +366 −0 src/assets/fabricator/scripts/fabricator.js
  14. +11 −0 src/assets/fabricator/scripts/lib/KeyController.js
  15. +582 −0 src/assets/fabricator/scripts/prism.js
  16. +15 −0 src/assets/fabricator/styles/base/variables.css
  17. +81 −0 src/assets/fabricator/styles/components/item.css
  18. +24 −0 src/assets/fabricator/styles/components/label.css
  19. +67 −0 src/assets/fabricator/styles/components/layout.css
  20. +23 −0 src/assets/fabricator/styles/components/masthead.css
  21. +58 −0 src/assets/fabricator/styles/components/nav.css
  22. +30 −0 src/assets/fabricator/styles/components/swatch.css
  23. +21 −0 src/assets/fabricator/styles/fabricator.css
  24. +3 −0 src/assets/fabricator/styles/utils/display.css
  25. +24 −0 src/assets/fabricator/styles/utils/layout.css
  26. +13 −0 src/assets/fabricator/styles/utils/list.css
  27. +4 −0 src/assets/fabricator/styles/utils/space.css
  28. +123 −0 src/assets/fabricator/styles/vendor/prism.css
  29. +5 −0 src/assets/toolkit/scripts/toolkit.js
  30. +7 −0 src/assets/toolkit/styles/toolkit.css
  31. +8 −0 src/data/toolkit.yml
  32. +5 −0 src/docs/javascript.md
  33. BIN src/favicon.ico
  34. +9 −0 src/materials/components/button.html
  35. +3 −0 src/materials/components/checkbox.html
  36. +1 −0 src/materials/components/paragraph.html
  37. +11 −0 src/materials/components/radio.html
  38. +7 −0 src/materials/components/select.html
  39. +38 −0 src/materials/components/table.html
  40. +2 −0 src/materials/components/text-input.html
  41. +1 −0 src/materials/components/textarea.html
  42. +11 −0 src/views/components.html
  43. +14 −0 src/views/docs.html
  44. +43 −0 src/views/index.html
  45. +40 −0 src/views/layouts/default.html
  46. +21 −0 src/views/layouts/includes/f-icons.html
  47. +26 −0 src/views/layouts/includes/f-item-content.html
  48. +12 −0 src/views/layouts/includes/f-item-header-content.html
  49. +21 −0 src/views/layouts/includes/f-item.html
  50. +8 −0 src/views/layouts/includes/f-masthead.html
  51. +49 −0 src/views/layouts/includes/f-nav.html
  52. +15 −0 src/views/pages.html
  53. +3 −0 src/views/pages/home.html
  54. +13 −0 src/views/sandbox.html
  55. +1 −0 src/views/sandbox/misc.html
  56. +38 −0 webpack.config.js
@@ -0,0 +1,3 @@
{
"stage": 2
}
@@ -0,0 +1,17 @@
# http://editorconfig.org
root = true
[*]
charset = utf-8
end_of_line = lf
indent_size = 4
indent_style = tab
insert_final_newline = true
trim_trailing_whitespace = true
[*.md]
trim_trailing_whitespace = false
[{*.json,*.yml}]
indent_size = 2
indent_style = space
@@ -0,0 +1 @@
* text=auto
@@ -0,0 +1,3 @@
node_modules
dist
.sass-cache
@@ -0,0 +1,20 @@
{
"boss": true,
"browser": true,
"curly": true,
"debug": true,
"devel": true,
"eqeqeq": true,
"expr": true,
"forin": true,
"immed": true,
"noarg": true,
"node": true,
"noempty": true,
"nonew": true,
"strict": true,
"trailing": true,
"undef": true,
"unused": true,
"globals": {}
}
@@ -0,0 +1,12 @@
language: node_js
node_js:
- "0.10"
notifications:
webhooks:
urls:
- YOUR_WEBHOOK_URL
on_success: change # options: [always|never|change] default: always
on_failure: always # options: [always|never|change] default: always
on_start: false # default: false
@@ -0,0 +1,83 @@
[![Build Status](https://travis-ci.org/fbrctr/fabricator.svg)](https://travis-ci.org/fbrctr/fabricator) [![devDependency Status](https://david-dm.org/fbrctr/fabricator/dev-status.svg)](https://david-dm.org/fbrctr/fabricator#info=devDependencies) [![Join the chat at https://gitter.im/fbrctr/fabricator](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/fbrctr/fabricator?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
<p align="center">
<img src="http://fbrctr.github.io/assets/toolkit/images/logo.svg" width="500">
</p>
# Fabricator
> _fabricate_ - to make by assembling parts or sections.
Fabricator is a tool for building website UI toolkits - _think ["Tiny Bootstraps, for Every Client"](http://daverupert.com/2013/04/responsive-deliverables/#tiny-bootstraps-for-every-client)_
## Quick Start
```shell
$ curl -L https://github.com/resource/fabricator/archive/master.tar.gz | tar zx --strip 1
$ npm start
```
## Documentation
#### [Read the docs →](http://fbrctr.github.io/docs)
## Demo
#### [Default Fabricator Instance →](http://fbrctr.github.io/demo)
## Credits
Created by [Luke Askew](http://twitter.com/lukeaskew).
Logo by [Abby Putinski](https://abbyputinski.com/)
## License
[The MIT License (MIT)](http://opensource.org/licenses/mit-license.php)
## Cloud Four Additions and Changes
We've made some changes and enhancements of our own. The presentation of the fabricator UI has been modified quite a bit. Also...:
### Handlebars Helpers
We've added additional available Handlebars (template) helpers. See `build/helpers` for source.
### Additional Front-Matter Metadata
You can of course add any front matter you like to materials. We've added specific support in templates for some special attributes:
`links`: This is an object. Keys will be used for display, values should be the URL. These will be rendered along with the material as resource/reference external links.
Example:
```yaml
---
links:
The Best Web Site Ever: http://www.example.com
Another site: https://www.foo.com
---
```
`labels`: This is an array. Values of the array will be used as label class identifiers. Labels express the status of the material in question. Unrecognized labels will be displayed as well, but without color highlighting (in current implementation, gray).
Defined labels:
* `inprogress` (yellow)
* `deprecated` (red)
* `approved` (green)
Example:
```yaml
---
labels:
- inprogress
- totoro
---
```
### Workflow Changes
* We've opted for `post-css` instead of the default Sass that ships with Fabricator.
* We've removed `csso` (optimization).
@@ -0,0 +1,5 @@
'use strict';
module.exports = function displayName(name) {
var pattern = /^[0-9]{0,4}[-_]?\s+?/;
return name.replace(pattern, '');
};
@@ -0,0 +1,10 @@
/* https://github.com/zeke/handlebars-helper-equal/blob/master/index.js */
module.exports = function(lvalue, rvalue, options) {
if (arguments.length < 3)
throw new Error("Handlebars Helper equal needs 2 parameters")
if (lvalue != rvalue) {
return options.inverse(this)
} else {
return options.fn(this)
}
};
@@ -0,0 +1,11 @@
'use strict';
var moment = require('moment');
module.exports = function (context, options) {
var date = options ? context : Date.now();
var options = options || context;
var format = options.hash.format || 'YYYY-MM-DD';
// http://momentjs.com/docs/#/displaying/
return moment(date).format(format);
}
@@ -0,0 +1,184 @@
'use strict';
// modules
var assemble = require('fabricator-assemble');
var browserSync = require('browser-sync');
var cssnext = require('cssnext');
var del = require('del');
var gulp = require('gulp');
var gutil = require('gulp-util');
var gulpif = require('gulp-if');
var imagemin = require('gulp-imagemin');
var postcss = require('gulp-postcss');
var rename = require('gulp-rename');
var reload = browserSync.reload;
var requireDir = require('require-dir');
var runSequence = require('run-sequence');
var webpack = require('webpack');
// configuration
var config = {
dev: gutil.env.dev,
src: {
scripts: {
fabricator: './src/assets/fabricator/scripts/fabricator.js',
toolkit: './src/assets/toolkit/scripts/toolkit.js'
},
styles: {
fabricator: 'src/assets/fabricator/styles/fabricator.css',
toolkit: 'src/assets/toolkit/styles/toolkit.css'
},
images: 'src/assets/toolkit/images/**/*',
views: 'src/toolkit/views/*.html'
},
dest: 'dist'
};
// webpack
var webpackConfig = require('./webpack.config')(config);
var webpackCompiler = webpack(webpackConfig);
// clean
gulp.task('clean', function (cb) {
del([config.dest], cb);
});
// styles
gulp.task('styles:fabricator', function () {
return gulp.src(config.src.styles.fabricator)
.pipe(postcss([
cssnext()
]))
.pipe(rename('f.css'))
.pipe(gulp.dest(config.dest + '/assets/fabricator/styles'))
.pipe(gulpif(config.dev, reload({stream:true})));
});
gulp.task('styles:toolkit', function () {
return gulp.src(config.src.styles.toolkit)
.pipe(postcss([
cssnext()
]))
.pipe(gulp.dest(config.dest + '/assets/toolkit/styles'))
.pipe(gulpif(config.dev, reload({stream:true})));
});
gulp.task('styles', ['styles:fabricator', 'styles:toolkit']);
// scripts
gulp.task('scripts', function (done) {
webpackCompiler.run(function (error, result) {
if (error) {
gutil.log(gutil.colors.red(error));
}
result = result.toJson();
if (result.errors.length) {
result.errors.forEach(function (error) {
gutil.log(gutil.colors.red(error));
});
}
done();
});
});
// images
gulp.task('images', ['favicon'], function () {
return gulp.src(config.src.images)
.pipe(imagemin())
.pipe(gulp.dest(config.dest + '/assets/toolkit/images'));
});
gulp.task('favicon', function () {
return gulp.src('./src/favicon.ico')
.pipe(gulp.dest(config.dest));
});
// assemble
gulp.task('assemble', function (done) {
assemble({
// apply additional helpers
helpers: requireDir('./build/helpers')
});
done();
});
// server
gulp.task('serve', function () {
browserSync({
server: {
baseDir: config.dest,
},
notify: false,
ghostMode: false,
minify: false,
online: false,
open: false,
port: 3000,
logPrefix: 'FABRICATOR'
});
/**
* Because webpackCompiler.watch() isn't being used
* manually remove the changed file path from the cache
*/
function webpackCache(e) {
var keys = Object.keys(webpackConfig.cache);
var key, matchedKey;
for (var keyIndex = 0; keyIndex < keys.length; keyIndex++) {
key = keys[keyIndex];
if (key.indexOf(e.path) !== -1) {
matchedKey = key;
break;
}
}
if (matchedKey) {
delete webpackConfig.cache[matchedKey];
}
}
gulp.task('assemble:watch', ['assemble'], reload);
gulp.watch('src/**/*.{html,md,json,yml}', ['assemble:watch']);
gulp.task('styles:fabricator:watch', ['styles:fabricator'], reload);
gulp.watch('src/assets/fabricator/styles/**/*.css', ['styles:fabricator:watch']);
gulp.task('styles:toolkit:watch', ['styles:toolkit'], reload);
gulp.watch('src/assets/toolkit/styles/**/*.css', ['styles:toolkit:watch']);
gulp.task('scripts:watch', ['scripts'], reload);
gulp.watch('src/assets/{fabricator,toolkit}/scripts/**/*.js', ['scripts:watch']).on('change', webpackCache);
gulp.task('images:watch', ['images'], reload);
gulp.watch(config.src.images, ['images:watch']);
});
// default build task
gulp.task('default', ['clean'], function () {
// define build tasks
var tasks = [
'styles',
'scripts',
'images',
'assemble'
];
// run build
runSequence(tasks, function () {
if (config.dev) {
gulp.start('serve');
}
});
});
Oops, something went wrong.

0 comments on commit 1329b2d

Please sign in to comment.