Nearly Perpendicular Macaroons

    bower-component-files

    1.0.2 • Public • Published

    bower-component-files

    NPM version Dependency Status devDependency Status Build Status Build Status Build Status

    Synopsis

    bower-component-files is used to copy/fetch dependency files (js, css, less, etc) from bower dependency packages to a web application directory. Following functions are available.

    1. bowerComponentFiles.copyMainFiles(filter : Array<String>/Object, options : Object)

    The method copies main files that match regular expression, to the corresponding destination.

    eg:

      bowerComponentFiles.copyMainFiles({"*.js": "./webapp/vendor/{{comp_name}}/js",
                                "*.css": "./webapp/vendor/{{comp_name}}/css",
                                "*.less": "./webapp/vendor/{{comp_name}}/less"},
                                { exclude: '*boot*.js' });
     
    1. bowerComponentFiles.copyComponentFiles(filter : Array<String>/Object, options : Object)

    The method copies files from specified directory under specified component/package to the corresponding destination. This method is used to copy files not mentioned as main files in bower.json.

    eg:

      bowerComponentFiles.copyComponentFiles("moment", {'*.js': './webapp/vendor/{{comp_name}}/js'});
    1. bowerComponentFiles.getMainFiles(filter : Array<String>, options : Object) : Array<String>

    The method fetches main files that match regular expression, which can be fed to gulp to process further.

    eg:

      gulp.src(bowerComponentFiles.getMainFiles(["*.js", "*.css"],)).pipe(  gulp.dest( 'dest/lib'));
     
    1. bowerComponentFiles.getComponentFiles(filter : Array<String>, options : Object) : Array<String>

    eg:

     
      gulp.src(bowerComponentFiles.getComponentFiles('jquery',
       ["dist/*.js", "dist/*.css"], {})).pipe(gulp.dest('dest/lib'));
     

    Filter eg:

     
    1. {
          "*.js": "./webapp/js",
          "*.css": "./webapp/css",
          "*.less": "./webapp/less"
          // ...
       }
    2. {
          "*.js": "./webapp/vendor/{{comp_name}}/js",
          "*.css": "./webapp/vendor/{{comp_name}}/css",
          "*.less": "./webapp/vendor/{{comp_name}}/less"
          // ...
        }
        // Note: Currently comp_name & comp_version are supported.
     
    3. ["*.js", "*.css"]
        // Note: Default destination is '.' in this case. Every extention would
        // create a sub-directory.
        // This would be compiled as
        {
            "*.js": "./js",
            "*.css": "./css",
        }
     

    Installation

    npm install bower-component-files

    Usage

    var bowerComponentFiles = require('bower-component-files');
     
    bowerComponentFiles.copyMainFiles({ "*.js": "./webapp/js",
                                        "*.css": "./webapp/css",
                                        "*.less": "./webapp/less"
                                      },
                                      { exclude: '*boot*.js' });

    Testing

    [sudo] npm test

    With test coverage:

    [sudo] npm test --coverage

    License

    The MIT License (MIT)

    Copyright (c) 2016 Nikhil Gahlot

    Keywords

    none

    Install

    npm i bower-component-files

    DownloadsWeekly Downloads

    0

    Version

    1.0.2

    License

    MIT

    Last publish

    Collaborators

    • gahlotnikhil