Skip to content

1.x configuration env

Kei Funagayama edited this page Feb 17, 2014 · 10 revisions

conf/[env].json

[env] とは

ローカル版、開発版、リリース版と言った環境別に設定を分けて管理するための 名前 です。

[env].jsonは、local.json, develop.json, product.json といったふうに複数作る事で、環境別の差異を設定ファイルで分離します。

設定内容

{
    "app": {
        "stat": {
            "compress": true,
            "port": 1109,
            "header": {
                "Access-Control-Allow-Origin" : "*",
                "Access-Control-Allow-Methods": "GET, OPTIONS",
                "Access-Control-Allow-Headers": "*"
            },
            "include": {
                "path": "./local",
                "from": null
            }
        },
        "mock": {
            "use": true,
            "compress": true,
            "port": 1121,
            "header": {
                "Access-Control-Allow-Origin" : "*",
                "Access-Control-Allow-Methods": "GET, OPTIONS",
                "Access-Control-Allow-Headers": "*"
            },
            "include": {
                "path": "./mockdata",
                "from": null
            }
        },
        "operation": [
            { "target": "build", "comment": "grunt build" },
            { "target": "deploy", "comment": "grunt deploy" },
            { "target": "default", "comment": "grunt default" },
            { "target": "jshint", "comment": "grunt jshint" },
            { "target": "clean", "comment": "grunt clean" },
            { "target": "docs", "comment": "grunt docs" }
        ]
    },
    "stats": {
        "tmp": {
            "path": "/tmp",
            "from": null
        }
    },
    "bootstrap": {
        "html": [ "*/index/index.html.hbs" ], // "[env][key].html" files match the pattern
        "datamain": [ "*/index/require.beez.js.hbs", "*/tutorial/require.beez.js.hbs" ] // "beez.require.[env][key].js" files match the pattern
    },
    "stylus": {
        "options": {
            "encode": "utf-8",
            "compress": true,
            "firebug": false,
            "linenos": false,
            "nib": true, // stylus nib on/of
            "url": {}, // @see http://learnboost.github.io/stylus/docs/functions.url.html
            "fn": {} // variable that can be used with stylus file
        },
        "extend": { // Overwrite the case of mobile data
            "condition": {
                "ua": [ "android", "ios" ]
            },
            "content": {
                "options": {}
            }
        }
    },
    "image": {
        "options": {
            "baseRatio": 2,
            "ratios": [ 1, 1.5, 2, 3 ],
            "extnames": [ ".png" ],
            "include": [],
            "exclude": [],
            "separator": "-"
        }
    },
    "sprite": {
        "options": {
            "ratios": [ 1, 1.3, 1.5, 2 ],
            "extnames": [ ".png", ".jpg" ],
            "heads": [ "sprite", "_sprite" ],
            "separator": "-"
        }
    },
    "deploy": {
        "optipng": true,
        "jpegoptim": true,
        "include": [ "dist/*/index.js", "dist/index/require.beez.*.js", "*.html", "*.css", "*.png", "*.jpg", "*.gif", "*.ttf", "*.eot", "*.woff" ],
        "exclude": [ "_*.css", "_*.png", "_*.jpg", "_*.gif", "_*.ttf", "_*.eot", "_*.woff" ]
    },
    "ignore": {
        "include": [],
        "exclude": []
    }
}

app.stat

開発Webサーバ設定情報

compress

GZIP圧縮可否

port

開発WebサーバのListenポート番号

#### header

開発WebサーバからのHTTP Response header に追記するヘッダー情報リスト

include

[key].json を探すベースディレクトリパス

path

相対パス、絶対パスが指定可能

from

node.js resolve 関数を参照


app.mock

モックサーバ設定情報

compress

GZIP圧縮可否

port

モックサーバのListenポート番号

#### header

モックサーバからのHTTP Response header に追記するヘッダー情報リスト

include

モックデータ定義JSONファイル を探すベースディレクトリパス

path

相対パス、絶対パスが指定可能

from

node.js resolve 関数を参照


app.operation

「開発Webサーバ」 -> 「Operation」画面で選択できる「grunt」コマンドの情報リスト

target

gruntコマンドの引数(target)

comment

画面に表示するコマンドの説明


stats

開発Webサーバから配信したいローカルディレクトリ情報

path

相対パス、絶対パスが指定可能

from

node.js resolve 関数を参照

/tmp を配信したい場合

keyのtmp と pathの末尾のディレクトリ名は一致させる必要があります。

    "stats": {
        "tmp": {
            "path": "/tmp",
            "from": null
        }
    },

bootstrap

html

テンプレートHTMLファイルのパスのマッチパターン

デフォルトでは、s/index/index.html.hbs に配置されていますが、別のフォルダに配置したい場合や、複数テンプレートHTMLファイルを配置したい場合に利用します。

生成される[env][key].html はhbsファイルと同一フォルダに作成されます。

datamain

require.js#data-mainファイルのパスのマッチパターン

デフォルトでは、s/index/require.beez.js.hbs に配置されていますが、別フォルダに配置したい場合や、複数パターンのファイルを配置する場合に利用します。

生成されるrequire.beez.[env][key].js はhbsファイルと同一フォルダに作成されます。


stylus.options

Beez, Beez Foundation で使用するStylusライブラリの設定情報

開発Webサーバの自動コンパイル及び、ビルド時のコンパイルで使用されます。

encode

Stylusファイルの文字コード

@see: http://learnboost.github.io/stylus/docs/executable.html

compress

コンパイル時の圧縮可否

@see: http://learnboost.github.io/stylus/docs/executable.html

firebug

firebug plugin 可否

@see: http://learnboost.github.io/stylus/docs/executable.html

linenos

@see: http://learnboost.github.io/stylus/docs/executable.html

nib

nib 利用可否

url

@see: http://learnboost.github.io/stylus/docs/functions.url.html

fn

stylusファイル内で利用できる変数 variable that can be used with stylus file

fn: {
    "service": "NAME"
}

stylus.extend @since: 1.0.14

特定のUserAgentの場合に、stylus.options を上書きする情報

"extend": { // Overwrite the case of mobile data
    "condition": {
        "ua": [ "android", "ios" ]
    },
    "content": {
        "options": {}
    }
}

開発Webサーバでは、自動コンパイル時に上書きされる ビルドでは、無効な設定

condition

上書きする条件

UserAgentのみサポート

content

stylus.options に上書きするデータ


image.options

指定された画像ファイルの画像処理の設定情報

開発Webサーバ と ビルド両方で使用されます。

baseRatio

対象画像の Pixelratio 値

ratios

baseRatioで設定した Pixelratio 値以外で画像リサイズしたい Pixelratio 値

extnames

画像処理するファイルの拡張子

include

リサイズをするファイル名 or ディレクトリ パス

"include": [ "s/hoge/img", "s/foo/bar.png" ],

exclude

リサイズをしないファイル名 or ディレクトリ パス

separator

リサイズしたファイル名に使用する、リサイズ前のファイル名とratio値の接続文字

defualt) '-'


sprite.options

パターンにマッチした複数の画像ファイルを Sprite 画像にまとめ、合わせてStylusファイルを同一フォルダに生成

ratios

生成するsprite sheetのratio 値

extnames

sprite sheetのpartsとなる画像の対象拡張子

heads

sprite sheetの元画像パーツの画像ファイル名の接頭子

separator

画像ファイル名の headratio の接続文字


deploy

デプロイする際に使用する設定情報

optipng

optipngコマンドを利用して画像圧縮行うか

jpegoptim

jpegoptimコマンドを利用して画像圧縮行うか

include

デプロイするファイルパターン

exclude

デプロイしないファイルパターン


ignore

release ディレクトリから除外する設定情報

include

除外するファイルパターン

exclude

除外しないファイルパターン

Clone this wiki locally