Last active
December 17, 2015 10:49
-
-
Save katapad/5597663 to your computer and use it in GitHub Desktop.
grunt-contrib-jade でいい感じにオプションを渡してあげるやつ
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
_ = 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'] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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