Skip to content

A brunch plugin to replace predefined keywords of public files after every compilation.

License

Notifications You must be signed in to change notification settings

huafu/keyword-brunch

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

55 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

keyword-brunch

A brunch plugin to replace predefined keywords of public files after every compilation.

Usage

Install

Add "keyword-brunch": "x.y.z" to package.json of your brunch app. Pick a plugin version that corresponds to your minor (y) brunch version.

If you want the latest repository version, install the plugin by running the following command:

npm install --save "git+ssh://[email protected]:huafu/keyword-brunch.git"

Usage in your application

Usage:

module.exports = 
  keyword:
    # file filter
    filePattern: /\.(js|css|html)$/

    # Extra files to process which `filePattern` wouldn't match
    extraFiles: [
      "public/humans.txt"
    ]

    # By default keyword-brunch has these keywords:
    #     {!version!}, {!name!}, {!date!}, {!timestamp!}
    # using information from package.json
    map:
      myDate: -> (new Date).toISOString()
      someString: "hello"

The plugin will replace any keyword in map surrounded with '{!' and '!}' by the result of the given associated function or with the given associated string. The functions are re-calculated on every build, but only once per build, not at every file. So you can make some keywords for the current git repository branch, commit hash, ...

About

A brunch plugin to replace predefined keywords of public files after every compilation.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • CoffeeScript 91.5%
  • HTML 3.8%
  • JavaScript 2.4%
  • CSS 2.3%