From 51848e697d87b770e1af6a4f6397bb2ad9f30608 Mon Sep 17 00:00:00 2001 From: wangkai Date: Tue, 5 Dec 2017 18:51:57 +0800 Subject: [PATCH] use gulp-umd --- dist/angular-wt-genius-min.js | 2 +- dist/angular-wt-genius.js | 72 +++++++++++++++++------------------ gulpfile.js | 15 ++++---- 3 files changed, 45 insertions(+), 44 deletions(-) diff --git a/dist/angular-wt-genius-min.js b/dist/angular-wt-genius-min.js index 6baf327..1acebe1 100644 --- a/dist/angular-wt-genius-min.js +++ b/dist/angular-wt-genius-min.js @@ -1 +1 @@ -!function(i,e){"function"==typeof define&&define.amd?define(["Notify"],e):"object"==typeof exports?module.exports=e(require("Notify")):i.$wtNotify=e(i.Notify)}(this,function(i){var e=angular.module("wt.genius",[]);return angular.module("wt.genius").provider("$wtNotify",[function(){var e={title:"Hey, 我在这里!",body:"",icon:"",tag:"",lang:"en",timeout:2,notifyShow:function(){},notifyClose:function(){},notifyClick:function(){},notifyError:function(){}},n={};this.config=function(i){n=i},this.$get=[function(){function t(t){var o=this.options=angular.extend({},e,n,t),r=new i["default"](o.title,o);s.needsPermission?s.requestPermission(function(){r.show()}):r.show()}var o,s=i["default"];return o={notify:function(i){return new t(i)},notSetPermission:"default"==s.permissionLevel,checkPermission:function(i,e,n){if(s.needsPermission){if(!s.isSupported())return;s.requestPermission(function(){o.permissionLevel="granted",o.needsPermission=!1,i&&i()},function(){o.permissionLevel="denied",o.needsPermission=!0,e&&e()},function(){o.notSetPermission=!0})}else o.permissionLevel="granted",i&&i();o.notSetPermission=!1,n&&n()},needsPermission:s.needsPermission,requestPermission:s.requestPermission,isSupported:s.isSupported,permissionLevel:s.permissionLevel}}]}]),function(){"use strict";angular.module("wt.genius").provider("$wtRetina",[function(){var i={};this.config=function(e){i=e},this.$get=[function(){var i="(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)",e=window.matchMedia(i);return{isRetina:e.matches,media:e.media}}]}])}(),e}); \ No newline at end of file +!function(e,i){"function"==typeof define&&define.amd?define(["notify"],i):"object"==typeof exports?module.exports=i(require("notify")):e.wtGenius=i(e.Notify)}(this,function(e){var i=angular.module("wt.genius",[]);return angular.module("wt.genius").provider("$wtNotify",[function(){var i={title:"Hey, 我在这里!",body:"",icon:"",tag:"",lang:"en",timeout:2,notifyShow:function(){},notifyClose:function(){},notifyClick:function(){},notifyError:function(){}},n={};this.config=function(e){n=e},this.$get=[function(){function t(t){var o=this.options=angular.extend({},i,n,t),r=new e["default"](o.title,o);s.needsPermission?s.requestPermission(function(){r.show()}):r.show()}var o,s=e["default"];return o={notify:function(e){return new t(e)},notSetPermission:"default"==s.permissionLevel,checkPermission:function(e,i,n){if(s.needsPermission){if(!s.isSupported())return;s.requestPermission(function(){o.permissionLevel="granted",o.needsPermission=!1,e&&e()},function(){o.permissionLevel="denied",o.needsPermission=!0,i&&i()},function(){o.notSetPermission=!0})}else o.permissionLevel="granted",e&&e();o.notSetPermission=!1,n&&n()},needsPermission:s.needsPermission,requestPermission:s.requestPermission,isSupported:s.isSupported,permissionLevel:s.permissionLevel}}]}]),angular.module("wt.genius").provider("$wtRetina",[function(){var e={};this.config=function(i){e=i},this.$get=[function(){var e="(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)",i=window.matchMedia(e);return{isRetina:i.matches,media:i.media}}]}]),i}); \ No newline at end of file diff --git a/dist/angular-wt-genius.js b/dist/angular-wt-genius.js index 59169cb..5613e98 100644 --- a/dist/angular-wt-genius.js +++ b/dist/angular-wt-genius.js @@ -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 * @@ -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; })); diff --git a/gulpfile.js b/gulpfile.js index 6c000fc..d5d3573 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -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'); @@ -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/')); }); @@ -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' }