bower-component-files
A package to copy/fetch dependency files (js, css, less, etc) from bower dependency packages to a web application directory.
Last updated 4 years ago by gahlotnikhil .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install bower-component-files 
SYNC missed versions from official npm registry.

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

Current Tags

  • 1.0.2                                ...           latest (4 years ago)

3 Versions

  • 1.0.2                                ...           4 years ago
  • 1.0.1                                ...           4 years ago
  • 1.0.0                                ...           4 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 2
Last Day 0
Last Week 1
Last Month 2
Dependencies (3)
Dev Dependencies (7)
Dependents (0)
None

Copyright 2014 - 2016 © taobao.org |