Skip to content

Instantly share code, notes, and snippets.

@katapad
Last active December 17, 2015 10:49
Show Gist options
  • Save katapad/5597663 to your computer and use it in GitHub Desktop.
Save katapad/5597663 to your computer and use it in GitHub Desktop.
grunt-contrib-jade でいい感じにオプションを渡してあげるやつ
module.exports = exports =
base:
title: 'タイトルです'
description: '説明です'
keywords: "katapad"
bodyClass: ''
common:
img: '../common/img'
css: '../common/css'
js: '../common/js'
analytics_id: 'UA-xxxxx-xx'
about:
title: 'このサイトについて | サイトタイトル'
bodyClass: 'about'
_ = require 'lodash'
module.exports = (grunt) ->
grunt.loadNpmTasks 'grunt-contrib-jade'
require('./src/config/jade.config.coffee')(_)
jadeOptions = require './src/config/base.config.coffee'
grunt.initConfig
jade:
options:
pretty: true
about:
options:
data: config.getData jadeOptions.base, jadeOptions.about
files: ['www/misc/about.html': 'src/jade/misc/about.jade']
module.exports = exports = (_) ->
result =
config:
getData: (options...) ->
if not options
return null
for option, i in options
if i == 0
r = _.clone option, true
else
r = _.merge r, option
return r
return result
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment