Skip to content

Commit

Permalink
use gulp-umd
Browse files Browse the repository at this point in the history
  • Loading branch information
walkerkay committed Dec 5, 2017
1 parent 2e1fe52 commit 51848e6
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 44 deletions.
2 changes: 1 addition & 1 deletion dist/angular-wt-genius-min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

72 changes: 36 additions & 36 deletions dist/angular-wt-genius.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,47 @@
;(function(root, factory) {
if (typeof define === 'function' && define.amd) {
define(['Notify'], factory);
define(['notify.js/dist/notify.js'], factory);
} else if (typeof exports === 'object') {
module.exports = factory(require('Notify'));
module.exports = factory(require('notify.js/dist/notify.js'));
} else {
root.wtGenius = factory(root.Notify);
}
}(this, function(Notify) {
var wtGenius = angular.module('wt.genius', []);
/**
* $wtRetina
*
* Version: 1.0.0 - 2015-10-19
* Anthor: zhenshuai
*/
angular.module('wt.genius')
.provider('$wtRetina', [function () {
var defaults = {
onchange: function () {
//console.log('dpi 切换事件');
}
};
var configOptions = {};
this.config = function (value) {
configOptions = value;
};
this.$get = [
function () {
var mediaQuery = "(min--moz-device-pixel-ratio: 1.5),\
(-o-min-device-pixel-ratio: 3/2),\
(-webkit-min-device-pixel-ratio: 1.5),\
(min-device-pixel-ratio: 1.5),\
(min-resolution: 144dpi),\
(min-resolution: 1.5dppx)";

var matchObj = window.matchMedia(mediaQuery);
return {
isRetina: matchObj.matches,
media : matchObj.media
};
}
];
}]);
/**
* $wtNotify
*
Expand Down Expand Up @@ -91,39 +125,5 @@ angular.module('wt.genius')
return result;
}];
}]);
/**
* $wtRetina
*
* Version: 1.0.0 - 2015-10-19
* Anthor: zhenshuai
*/
angular.module('wt.genius')
.provider('$wtRetina', [function () {
var defaults = {
onchange: function () {
//console.log('dpi 切换事件');
}
};
var configOptions = {};
this.config = function (value) {
configOptions = value;
};
this.$get = [
function () {
var mediaQuery = "(min--moz-device-pixel-ratio: 1.5),\
(-o-min-device-pixel-ratio: 3/2),\
(-webkit-min-device-pixel-ratio: 1.5),\
(min-device-pixel-ratio: 1.5),\
(min-resolution: 144dpi),\
(min-resolution: 1.5dppx)";

var matchObj = window.matchMedia(mediaQuery);
return {
isRetina: matchObj.matches,
media : matchObj.media
};
}
];
}]);
return wtGenius;
}));
15 changes: 8 additions & 7 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ var concat = require('gulp-concat');
var uglify = require('gulp-uglify');
var plumber = require('gulp-plumber');
var umd = require('gulp-umd');

//var del = require('del');


Expand All @@ -25,7 +26,7 @@ gulp.task('style', function () {
.pipe(concat('angular-wt-genius-min.css'))
.pipe(autoprefixer({
browsers: ['last 2 versions'],
cascade : false
cascade: false
}))
.pipe(gulp.dest('./dist/'));
});
Expand All @@ -34,18 +35,18 @@ gulp.task('js', function () {
.pipe(plumber({errorHandler: error}))
.pipe(concat('angular-wt-genius.js'))
.pipe(umd({
exports: function(file) {
exports: function (file) {
return 'wtGenius';
},
namespace: function(file) {
namespace: function (file) {
return 'wtGenius';
},
dependencies: function(file) {
dependencies: function (file) {
return [
{
name: 'Notify',
amd: 'Notify',
cjs: 'Notify',
name: 'notify.js/dist/notify.js',
amd: 'notify.js/dist/notify.js',
cjs: 'notify.js/dist/notify.js',
global: 'Notify',
param: 'Notify'
}
Expand Down

0 comments on commit 51848e6

Please sign in to comment.