Skip to content

Latest commit

 

History

History
69 lines (51 loc) · 1.94 KB

readme.md

File metadata and controls

69 lines (51 loc) · 1.94 KB

component-static

example for single-page webapp

├── component.json      #define package
├── example.html
├── readme.md
└── source
    ├── index.css       #main css
    ├── index.js        #main js
    ├── handler.js      #handler with history.pushState
    ├── tpl.js
    └── tpl
        ├── builder.js  #build ./*.jade > ../tpl.js
        ├── 404.jade
        ├── base.jade
        └── login.jade

install

npm install component -g

#1.build from source
npm install jade
git clone https://github.com/yanyaoer/component-static {{ static_path }}
cd {{ static_path }}

#2.get static_file only
component install yanyaoer/component-static@master

component install
component build

example

cd {{ static_path }}
python -m SimpleHTTPServer 9001
open -a http://0.0.0.0:9001/example.html

automate

# add to .vimrc
let $static_path = {{ static_path }}
function! Static_build()
    if expand('%:e') == 'jade' 
        execute '!cd '.$static_path.'source/tpl/; node builder.js'
    endif
    execute '!cd '.$static_path.'; component build'
endfunction
au bufwritepost * if expand('%:p') =~ expand($static_path) | silent call Static_build() | endif

or write script with visionmedia-watch

reference

component

backbone github

backbone.marionette github doc pattern

zepto

jade