Code Monkey home page Code Monkey logo

grunt-city's Introduction

grunt-city

  • client side application template
  • provides build, lint, minify, server and livereload

install

git clone geta6/grunt-city myapp
cd myapp
npm -g i grunt-cli
npm i

run

grunt

usage

Grunt: The JavaScript Task Runner (v0.4.2)

Usage
 grunt [options] [task [task ...]]

Options
    --help, -h  Display this help text.
        --base  Specify an alternate base path. By default, all file paths are
                relative to the Gruntfile. (grunt.file.setBase) *
    --no-color  Disable colored output.
   --gruntfile  Specify an alternate Gruntfile. By default, grunt looks in the
                current or parent directories for the nearest Gruntfile.js or
                Gruntfile.coffee file.
   --debug, -d  Enable debugging mode for tasks that support it.
       --stack  Print a stack trace when exiting with a warning or fatal error.
   --force, -f  A way to force your way past warnings. Want a suggestion? Don't
                use this option, fix your code.
       --tasks  Additional directory paths to scan for task and "extra" files.
                (grunt.loadTasks) *
         --npm  Npm-installed grunt plugins to scan for task and "extra" files.
                (grunt.loadNpmTasks) *
    --no-write  Disable writing files (dry run).
 --verbose, -v  Verbose mode. A lot more information output.
 --version, -V  Print the grunt version. Combine with --verbose for more info.
  --completion  Output shell auto-completion rules. See the grunt-cli
                documentation for more information.

Options marked with * have methods exposed via the grunt API and should instead
be specified inside the Gruntfile wherever possible.

Available tasks
          copy  Copy files. *
        coffee  Compile CoffeeScript files into JavaScript *
        stylus  Compile Stylus files into CSS *
          jade  Compile jade templates. *
    coffeelint  Validate files with CoffeeLint *
       csslint  Lint CSS files with csslint *
        uglify  Minify files with UglifyJS. *
      imagemin  Minify PNG and JPEG images *
       connect  Start a connect web server. *
         watch  Run predefined tasks whenever watched files change.
   simplemocha  Run tests with mocha *
        notify  Show an arbitrary notification whenever you need. *
  notify_hooks  Config the automatic notification hooks.
       jsbuild  Alias for "copy:js", "coffeelint", "coffee", "uglify" tasks.
      cssbuild  Alias for "copy:css", "stylus", "csslint" tasks.
      imgbuild  Alias for "copy:img", "imagemin" tasks.
         build  Alias for "imgbuild", "cssbuild", "jsbuild", "jade" tasks.
          test  Alias for "build", "simplemocha" tasks.
       default  Alias for "build", "connect", "watch" tasks.

Tasks run in the order specified. Arguments may be passed to tasks that accept
them by using colons, like "lint:files". Tasks marked with * are "multi tasks"
and will iterate over all sub-targets if no argument is specified.

The list of available tasks may change based on tasks directories or grunt
plugins specified in the Gruntfile or via command-line options.

For more information, see http://gruntjs.com/

options

  • port
    • static server port
    • assets server on localhost with port 3000 default
  • mode
    • mode dev serves un-minified assets, default
    • mode pro serves minified assets
  • index
    • static server fallback defaults to index.html

server core

request to unexists path, fallback to index file.

# route = req.url
# index = path.resolve 'public', 'index.html'

fs.exists route, (exist) ->
  fs.stat route, (err, stat) ->
    if exist and stat.isFile()
      return fs.createReadStream(route).pipe(res)
    return fs.createReadStream(index).pipe(res)

livereload

caution

  • static server is only for preview
  • is not compatible for production environment

license

MIT

grunt-city's People

Contributors

geta6 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.