Skip to content

Replace AngularJS references by libraries hosted on the Google CDN

License

Notifications You must be signed in to change notification settings

laurent-le-graverend/google-cdn-data-angular

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

25 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

google-cdn-data-angular

Google CDN data for google-cdn.

This module makes it easy to replace references in your app with links to the Angular libraries on the Google CDN.

Install

$ npm install --save-dev google-cdn google-cdn-data-angular

Usage

package.json:

{
  "name": "my-awesome-app",
  "dependencies": {
    "angular": "1.5.9"
  }
}
const googlecdn = require('google-cdn');
const fs = require('fs');
const assert = require('chai').assert;

const packageJson = JSON.parse(fs.readFileSync('package.json', 'utf8'));
const markup = '<script src="node_modules/angular/angular.js"></script>';

googlecdn(markup, packageJson, { cdn: require('google-cdn-data-angular') }, function(err, result) {
  if (err) {
    throw err;
  }
  assert.equal(result, '<script src="//ajax.googleapis.com/ajax/libs/angularjs/1.5.9/angular.min.js"></script>');
});

Easy usage with gulp-google-cdn

const gulp = require('gulp');
const googlecdn = require('gulp-google-cdn');

gulp.task('default', function () {
  return gulp.src('index.html')
    .pipe(googlecdn(require('./package.json'), {
      componentsPath: 'node_modules',
      cdn: require('google-cdn-data-angular')
    }))
    .pipe(gulp.dest('dist'));
});

License

MIT

About

Replace AngularJS references by libraries hosted on the Google CDN

Resources

License

Stars

Watchers

Forks

Packages

No packages published