5

ブランチのドキュメントによると、構成ファイルのプロパティ「conventions.assets」は正規表現である必要がありますが、次のものを含めようとしています:

conventions: {
    assets: /^app\/.*\.html/
}

すべてのhtmlをパブリックフォルダーに追加するため。(アセットフォルダーを作成してそこにすべてのものを含めることができることは知っていますが、合意した構造によると、現時点では不可能です)。

このプロパティにはディレクトリが必要だと思います。この場合、目標を達成するためにこの値を修正できますか?関数を使用できますか?

4

2 に答える 2

3

最後に、プロパティ「資産」が受け入れるメソッドをオーバーライドすることができました。

assets: function(path) {
    /**
     * Loops every path and returns path|true|false according what we need
     * @param   path    file or directory's path
     * @returns path    if it is a directory
     *          true    if it fit with the regular expression
     *          false   otherwise
     *
     */
    if( /\/$/.test(path) ) return path;
    return /^app\/.*\.html/.test(path); // RegExp for anything we need
}
于 2013-09-04T08:35:03.833 に答える
2

誰かが続行方法を理解するのに苦労している場合、私の関数がどのように見えるかについてコメントしたいと思いました:

assets: function(path) {
 /**
  * Loops every path and returns path|true|false according what we need
  * @param   path    file or directory's path
  * @returns path    if it is a directory
  *          true    if it fit with the regular expression
  *          false   otherwise
  *
  */
  if( /\/$/.test(path) ) return path;
  return /^(app|assets)\/.*\.(html|png|jpg|jpeg|eot|svg|ttf|woff)/.test(path);
}

これにより、app- と -assetsフォルダーの両方にあるファイルが拡張子: でhtml, png, jpg, jpeg, eot, svg, ttf, woff-フォルダーに移動されますpublic

フォルダーをルート構造に移動することにしassetsたので、構造は次のようになります。

frontend
  - app
  -- common/
  -- styles/
  -- etc etc
  - assets
  -- index.html
  -- css/
  -- images/
  -- etc etc
于 2016-08-25T09:30:08.813 に答える