UNPKG

4.72 kBMarkdownView Raw
1[![NPM version](https://badge.fury.io/js/compy.png)](http://badge.fury.io/js/compy)
2[![Dependency Status](https://gemnasium.com/edjafarov/compy.png)](https://gemnasium.com/edjafarov/compy)
3[![Build Status](https://travis-ci.org/edjafarov/compy.png?branch=master)](https://travis-ci.org/edjafarov/compy)
4compy - lightweight app builder/compiller
5=====
6Compy is a lightweight approach for developing web apps (framework/lib agnostic). Based on TJ's [component](https://github.com/component/component) package manager it allows you to install components and use them in your code right away.
7Compy makes your development fun by:
8
9* allowing you to use installed components without any configurations by just requiring them.
10* providing local ```require```
11* supporting coffeescript, sass, jade and other [plugins](#plugins)
12* giving you livereload with simple static server
13* setting up karma runner
14* being flexible and grunt extendable
15
16watch [screencast](http://www.youtube.com/watch?v=IYSPHvw2KSk) for details [some of functionality was changed in 0.1.3]
17
18##plugins
19compy can use component's [plugins](https://github.com/component/component/wiki/Plugins) to extend it's functionality. For example if you want to use coffee in your project, you need to ```npm install component-coffee``` in your project's folder.
20
21compy was tested with following plugins:
22- [rschmukler/component-stylus-plugin](https://github.com/rschmukler/component-stylus-plugin) — precompile stylus
23- [segmentio/component-jade](https://github.com/segmentio/component-jade) — precompile jade templates
24- [anthonyshort/component-coffee](https://github.com/anthonyshort/component-coffee) - require CoffeeScript files as scripts
25- [anthonyshort/component-sass](https://github.com/anthonyshort/component-sass) - compile Sass files using node-sass
26- [kewah/component-builder-handlebars](https://github.com/kewah/component-builder-handlebars) - precompile Handlebars templates
27- [ericgj/component-hogan](https://github.com/ericgj/component-hogan) - Mustache transpiler for component (using Hogan)
28- [segmentio/component-sass](https://github.com/segmentio/component-sass) — Sass transpiler for component
29- [segmentio/component-json](https://github.com/segmentio/component-json) — Require JSON files as Javascript.
30- [queckezz/component-roole](https://github.com/queckezz/component-roole) — Compile [Roole](http://roole.org) files
31- [Wizcorp/component-less](https://github.com/Wizcorp/component-less) - [LESS](https://github.com/less/less.js) transpiler for component-builder
32- [segmentio/component-markdown](https://github.com/segmentio/component-markdown) - Compile Markdown templates and make them available as Javascript strings.
33
34##install
35
36```$ npm install compy -g```
37
38## cli comands
39```
40 Usage: compy <command> [options]
41
42 Options:
43
44 -h, --help output usage information
45 -V, --version output the version number
46
47 Commands:
48
49 install [name ...] install dependencies or component
50 compile compile app (in dist folder by default)
51 build build the app (compile and minify sources)
52 server [watch] run static server. If "watch" option enabled - watch changes, recompile and push livereload
53 test run karma tests
54 watch watch and rebuild assets on change
55```
56## config
57The configuration for compy sits in package.json inside compy namespace. ```main``` is an entry point of your app and the only required property.
58
59```json
60{
61 "name": "appName",
62 "version": "0.0.0",
63 "description": "my awesome app",
64 "main": "index.js",
65 "license": "BSD",
66 "compy": {
67 "dependencies": {
68 "component/jquery": "*"
69 },
70 "main": "app.js"
71 }
72}
73```
74
75## what's about grunt?
76Compy is basically a grunt file that does all the magic. You can check it [here](https://github.com/edjafarov/compy/blob/master/Gruntfile.js)
77That also mean that is you want to use grunt in your project, you need to know some details.
78
79You can create local ```Grintfile.js``` inside your project. To run tasks though instead of ```grunt <taskname>``` you need to do ```compy <taskname>```
80
81There are ```compile``` and ```build``` tasks which you can extend/change. Original tasks have aliases ```compy-compile``` and ```compy-build``` ([src](https://github.com/edjafarov/compy/blob/588028693f1762cc1f59e9464f7824a2bdafd1ba/Gruntfile.js#L239-L241))
82
83So if you want to precompile something, your grunt file will look like:
84
85```javascript
86 ...
87 grunt.registerTask('compile',['<precompileTask>','compy-compile'])
88 ...
89```
90
91## license
92
93MIT
94