Sha256: 7674c5921710203f377a0b75598633be0f31f2f46d1309bb46ca3d1534307799

Contents?: true

Size: 1.97 KB

Versions: 5

Compression:

Stored size: 1.97 KB

Contents

module.exports = (grunt) ->

  Path = require('path')

  grunt.loadNpmTasks 'grunt-mincer'
  grunt.loadNpmTasks 'grunt-contrib-connect'
  grunt.loadNpmTasks 'grunt-contrib-uglify'
  grunt.loadNpmTasks 'grunt-contrib-cssmin'
  grunt.loadNpmTasks 'grunt-bower-task'

  grunt.registerTask 'joosy:compile', ['joosy:compile:code', 'joosy:compile:styles', 'joosy:compile:playground']
  grunt.registerTask 'joosy:compile:code', ['mince:code', 'uglify:application']
  grunt.registerTask 'joosy:compile:styles', ['mince:styles', 'cssmin:application']

  grunt.registerTask 'joosy:compile:playground', ->
    hamlc = require 'haml-coffee'
    grunt.file.write 'public/index.html', hamlc.compile(grunt.file.read 'source/index.haml')()

  grunt.registerTask 'joosy:server', ->
    @async()
    connect = require('connect')
    mincer  = require('mincer')
    hamlc   = require('haml-coffee')

    mincer.StylusEngine.registerConfigurator (stylus) ->
      stylus.options.paths.push Path.join(process.cwd(), 'public')
      stylus.use require('nib')()

    server = connect()
    assets = new mincer.Environment(process.cwd())
    assets.appendPath 'source',
    assets.appendPath 'stylesheets',
    assets.appendPath 'components'
    assets.appendPath 'vendor'
    assets.appendPath 'node_modules/joosy/lib'

    server.use '/assets', mincer.createServer(assets)

    server.use '/', (req, res, next) ->
      if req.url == '/'
        res.end hamlc.compile(grunt.file.read 'source/index.haml')()
      else
        next()
  
    server.use connect.static('public')
    server.listen 4000

  grunt.registerTask 'joosy:server:production', ->
    @async()
    connect = require('connect')
    server = connect()
    server.use require('gzippo').staticGzip('public')
    server.listen process.env['PORT'] ? 4000

  grunt.registerTask 'joosy:postinstall', ->
    @async

    if grunt.file.exists('bower.json')
      grunt.task.run 'bower:install'

    if process.env['NODE_ENV'] == 'production'
      grunt.task.run 'joosy:compile'

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
joosy-1.2.0.alpha.15 tasks/joosy.coffee
joosy-1.2.0.alpha.14 tasks/joosy.coffee
joosy-1.2.0.alpha.13 tasks/joosy.coffee
joosy-1.2.0.alpha.12 tasks/joosy.coffee
joosy-1.2.0.alpha.11 tasks/joosy.coffee