Search code examples
bowerbower-install

Best practice for front end library management using Bower


I want to use bower add manage my library, my question is along with the js files, it always comes with some extra json or git related files. I don't want to push those files to the client, is there a recommended way rather than extract js filed manually?


Solution

  • Bower allows you define in your bower.json file a list of files it will ignore when installing your package:

    ignore

    Recommended Type: Array of String

    A list of files for Bower to ignore when installing your package.

    Note: README (all variants of case, .md, .text) and bower.json will never be ignored.

    The ignore rules follow the same rules specified in the gitignore pattern spec.

    For example:

    {
      "name": "my-project",
      "version": "1.0.0",
      "main": "path/to/main.css",
      "ignore": [
        ".jshintrc",
        "**/*.txt"
      ],
      ...
    }
    

    Another option is keeping only the files you want to distribute in the Git tags which represents you package versions.