Permalink
Browse files

inital commit

  • Loading branch information...
1 parent 87cb782 commit 6933fd1b68d5b5fd01f4fdb8c06be4a1aed639e8 @Techwraith committed Feb 21, 2014
Showing 5,627 changed files with 1,145,910 additions and 0 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
View
@@ -0,0 +1 @@
+var temp = require('./test.html.hbs')
@@ -0,0 +1 @@
+node_modules/
@@ -0,0 +1,20 @@
+The MIT License (MIT)
+
+Copyright (c) 2014 Daniel Erickson
+
+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.
@@ -0,0 +1,15 @@
+#!/usr/bin/env node
+
+var cli = require('../lib/cli')
+ , argv = require('subarg')(process.argv.slice(2), {
+ alias: {
+ j: 'js'
+ , c: 'css'
+ , o: 'output'
+ , d: 'debug'
+ , h: 'help'
+ , v: 'version'
+ }
+ })
+
+cli(argv)
@@ -0,0 +1,31 @@
+var js = require('atomify-js')
+ , css = require('atomify-css')
+
+module.exports = function (opts) {
+
+ function error (e, resp) {
+
+ // Jaws-like router support
+ if (typeof resp.error == 'function') return resp.error(e)
+
+ resp.writeHead(500, {'Content-Type': 'text/plain'})
+ resp.end(e.message)
+
+ if (opts.js.debug) console.log(e.stack)
+
+ }
+
+ function respond (type, resp) {
+ return function (e, src) {
+ if (e) return error(e, resp)
+ resp.setHeader('content-type', 'text/'+type)
+ resp.end(src)
+ }
+ }
+
+ return {
+ css: function (req, resp) { css(opts.css, respond('css', resp)) }
+ , js: function (req, resp) { js(opts.js, respond('javascript', resp)) }
+ }
+
+}
@@ -0,0 +1,20 @@
+var js = require('atomify-js')
+ , css = require('atomify-css')
+ , http = require('./http')
+
+module.exports = atomify
+
+function atomify (opts, cb) {
+ if (opts.css) css(opts.css, callback(cb, 'css'))
+ if (opts.js) js(opts.js, callback(cb, 'js'))
+}
+
+atomify.js = js
+atomify.css = css
+atomify.http = http
+
+function callback (cb, type) {
+ return function (err, src) {
+ cb(err, src, type)
+ }
+}
@@ -0,0 +1,64 @@
+var js = require('atomify-js')
+ , css = require('atomify-css')
+ , fs = require('fs')
+ , writer = require('write-to-path')
+ , server = require('./server')
+
+module.exports = function (args) {
+ if (args._[0] === 'help' || args.help) {
+ return fs.createReadStream(__dirname + '/usage.txt')
+ .pipe(process.stdout)
+ .on('close', function () { process.exit(1) });
+ }
+
+ if (args.version) {
+ return console.log(require('../package.json').version);
+ }
+
+ if (args.css) {
+ args.css = parseArgs('css', args.css, args)
+
+ args.css.variables = args.css.v || args.css.variables
+ args.css.plugins = args.css.p || args.css.plugins
+ args.css.compress = args.css.c || args.css.compress
+
+ if (args.css.output) css(args.css, writer(args.css.output, args.css))
+ }
+
+ if (args.js) {
+ args.js = parseArgs('js', args.js, args)
+
+ args.js.watch = args.js.w || args.js.watch
+ args.js.transforms = args.js.t || args.js.transform
+
+ if (args.js.output) js(args.js, writer(args.js.output, args.js))
+ }
+
+ if (args.serve) server(args)
+}
+
+function parseArgs (ext, child, parent) {
+ if (typeof child === 'string') child = {entry: child} // -j entry.js
+ if (child._) child.entry = child._[0] // -j [ entry.js ]
+ if (typeof child.e === 'string') child.entry = child.e // -j [ -e entry.js ]
+ if (Array.isArray(child.e)) child.entries = child.e // -j [ -e entry.js -e other.js ]
+
+ if (child.entry.indexOf(':') > 0) {
+ var pieces = child.entry.split(':')
+ child.entry = pieces[0]
+ child.alias = pieces[1]
+ }
+
+ child.debug = child.d || child.debug || parent.debug
+
+ child.output = child.o || child.output
+ if (child._ && child._.length === 2) child.output = child._[1] // -j [ entry.js bundle.js ]
+ if (!child.output && parent.output) child.output = parent.output.indexOf(ext) > 1 ? parent.output : parent.output + '.' + ext
+
+ if (!child.output && !parent.serve) {
+ console.error('No output path provided for ' + ext.toUpperCase() + ' bundle!')
+ process.exit(1)
+ }
+
+ return child;
+}
@@ -0,0 +1,41 @@
+var st = require('st')
+ , http = require('http')
+ , js = require('atomify-js')
+ , css = require('atomify-css')
+ , open = require('open')
+
+module.exports = function (args) {
+
+ var mount = st(args.serve.st || process.cwd())
+ , port = args.serve.port || 1337
+ , launch = args.serve.open
+ , path = args.serve.path || ''
+ , url = args.serve.url || 'http://localhost:' + port + path
+
+ http.createServer(function(req, res) {
+
+ switch (req.url) {
+ case args.js.alias || args.js.entry:
+ js(args.js, responder('javascript', res))
+ break
+
+ case args.css.alias || args.css.entry:
+ css(args.css, responder('css', res))
+ break
+
+ default:
+ mount(req, res)
+ break
+ }
+
+ }).listen(port)
+
+ if (launch) open(url)
+}
+
+function responder (type, res) {
+ return function (err, src) {
+ if (!res.headersSent) res.setHeader('Content-Type', 'text/' + type)
+ res.end(src)
+ }
+}
@@ -0,0 +1,41 @@
+Usage: atomify -j [ JS OPTIONS ] -c [ CSS OPTIONS ] COMMON OPTIONS
+
+You can do basically everything with this CLI that you can do
+with the atomify module in code. Debug and output options
+can be provided as COMMON options to have them apply to both
+JS and CSS builds, or you can define them specifically for one
+or the other. All other flags must be provided directly using subarg syntax.
+
+Common Options:
+
+ --output, -o Write both bundles to a file with this name.
+ Specifying bundle would produce bundle.js and bundle.css
+ Can also be supplied directly to --js or --css option.
+
+ --debug -d Enable source maps for both JS and CSS.
+ Can also be supplied directly to --js or --css option.
+
+ --help, -h Show this message
+
+ --version, -v Show the current version
+
+JavaScript Options:
+
+--js, -j [ JS OPTIONS ] Options not mapped below will be passed on to Browserify
+
+ --entry, -e Entry point(s) of your app
+
+ --watch, -w Bundle and start watching for changes (via watchify)
+
+ --transforms, -t Use a transform module on top-level files. Same as Browserify -t option.
+
+CSS Options:
+
+--css, -c [ CSS OPTIONS ]
+
+ --variables, -v Variables to pass to rework-vars
+
+ --plugins, -p Plugin names to require() and pass to rework.use()
+
+ --compress, -c Compress the CSS bundle
+
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<module type="WEB_MODULE" version="4">
+ <component name="NewModuleRootManager">
+ <content url="file://$MODULE_DIR$" />
+ <orderEntry type="inheritedJdk" />
+ <orderEntry type="sourceFolder" forTests="false" />
+ </component>
+</module>
+
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+ <component name="ProjectCodeStyleSettingsManager">
+ <option name="PER_PROJECT_SETTINGS">
+ <value />
+ </option>
+ <option name="PREFERRED_PROJECT_CODE_STYLE" value="Space2" />
+ </component>
+</project>
+
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+ <component name="Encoding" useUTFGuessing="true" native2AsciiForPropertiesFiles="false" />
+</project>
+
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+ <component name="ProjectRootManager" version="2" />
+</project>
+
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+ <component name="ProjectModuleManager">
+ <modules>
+ <module fileurl="file://$PROJECT_DIR$/.idea/atomify-css.iml" filepath="$PROJECT_DIR$/.idea/atomify-css.iml" />
+ </modules>
+ </component>
+</project>
+
@@ -0,0 +1,5 @@
+<component name="DependencyValidationManager">
+ <state>
+ <option name="SKIP_IMPORT_STATEMENTS" value="false" />
+ </state>
+</component>
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+ <component name="VcsDirectoryMappings">
+ <mapping directory="$PROJECT_DIR$" vcs="Git" />
+ </component>
+</project>
+
Oops, something went wrong.

0 comments on commit 6933fd1

Please sign in to comment.