Giles wants you to stop writing HTML, CSS, and JS.
Giles is a static asset builder for a variety of useful markup languages. Use Giles to develop with nextgen web tools and increase project momentum.
giles -s command, and build files as they are requested.The goal of Giles is not to advocate a specific framework, rather to provide developers and designers functionality in the languages of their choice.
bash
sudo npm install -g giles
npm is available by installing nodejs
bash
giles
It will build every file into the same directory(views/index.jade will become views/index.html)
Giles ignores files that begin with '' (underscore). Use these for mixins, partials and etc. _
bash
giles -h
If you ever need to run this, file a bug with me.
bash
giles -c
This will remove all files where generation is possible - IE: it will remove layout.html if you have a layout.jade. Be safe out there!
bash
giles --ignore vendor,bin
ignore defaults to nodemodules,.git_
bash
giles -s -p 9000
-p is optional, and will default to 2255 if not specified
Note the flag -e is deprecated in favor of the NODE_ENV environment variable.
Environments are shortcuts that allow you to treat compilations differently. giles defaults to null if unspecified.
NODE_ENV=production giles <dir>
Compile assets in
Jade assets (and all compiled types that support local variables) can contain tests for the environment:
jade
- if(environment == 'production')
#prodOnly content
These examples are in coffeescript.
```coffeescript srcDir = PATHTOSOURCE options = {}
giles = require('giles') giles.build(srcDir, options) ```
coffeescript
giles = require('giles')
giles.server(dir, {port : 12345})
Try it for a lightweight development mode
coffeescript
connect.use(giles.connect(srcDir))
This connector will compile supported file types (index.jade will be compiled when index.html is requested). It does not serve any files.
It is imperative that you place this before `connect.static'
By default giles creates a 1-1 map of template to generated page. This allows you to use the same jade file with separate variables to generate a dynamic page that is built into a finite amount of static targets.
```coffeescript
locals = {name : "Martyn"}
giles.get '/dynamicPage.html', 'page.jade', locals ```
Then in page.jade
jade
!!!
head
title = name
coffeescript
coffee = require 'coffee-script'
giles.addCompiler ['.coffee', '.cs'], '.js', (contents, filename, output) ->
output(coffee.compile(contents, {}))
coffeescript
stylus = require 'stylus'
giles.addCompiler [".styl", ".stylus"], '.css', (contents, filename, output) ->
stylus.render contents, {filename: filename}, (err, css) ->
if err
console.error "Could not render stylus file: "+filename
console.error err
else
output(css)
Both of these compilers are already in giles and listed here for illustration purposes.
giles.get("/route", sourceFile, locals) for defining generated filesGiles is available under the MIT license. We hope you find it useful. Please let us at 255 BITS know if you use it for something cool.
Into every generation a slayer is born: one girl in all the world, a Chosen One. One born with the strength and skill to fight the vampires, to stop the spread of their evil and swell of their numbers.