Преглед на файлове

using gulp

Signed-off-by: Gerald <gera2ld@163.com>
Gerald преди 10 години
родител
ревизия
c69651bfc4
променени са 5 файла, в които са добавени 56 реда и са изтрити 3 реда
  1. 1 1
      README.md
  2. 1 1
      dist/duoshuo-ua-with-css.min.js
  3. 1 1
      dist/duoshuo-ua.min.js
  4. 29 0
      gulpfile.js
  5. 24 0
      package.json

+ 1 - 1
README.md

@@ -33,7 +33,7 @@ duoshuoQuery中可以定义`myIds`和`getUAString`函数:
 
 注:
 
-1. dist/duoshuo-ua.min.js是压缩后的代码,集成了CSS,无需单独加载CSS文件,如需自定义,请使用未压缩版本。
+1. dist/duoshuo-ua-with-css.min.js是压缩后的代码,集成了CSS,无需单独加载CSS文件,如需自定义,请使用未压缩版本。
 1. 此版本使用`Object.defineProperty`,仅支持IE9+。
 
 效果可参见:<http://geraldl.net/about>

Файловите разлики са ограничени, защото са твърде много
+ 1 - 1
dist/duoshuo-ua-with-css.min.js


Файловите разлики са ограничени, защото са твърде много
+ 1 - 1
dist/duoshuo-ua.min.js


+ 29 - 0
gulpfile.js

@@ -0,0 +1,29 @@
+var
+	gulp=require('gulp'),
+	wrap=require('gulp-wrap'),
+	rename=require('gulp-rename'),
+	concat=require('gulp-concat'),
+	merge=require('gulp-merge'),
+	uglify=require('gulp-uglify'),
+	minifycss=require('gulp-minify-css'),
+	css2js=require('gulp-css2js');
+gulp.task('default',function(){
+	var js=
+		gulp.src(['./src/ua-parser.js','./src/duoshuo-ua.js'])
+			.pipe(concat('duoshuo-ua.js'))
+			.pipe(wrap('(function(){\n<%=contents%>\n}());'))
+			.pipe(uglify())
+			.pipe(rename({suffix:'.min'}))
+			.pipe(gulp.dest('./dist'));
+	merge(
+		gulp.src('./src/duoshuo-ua.css')
+			.pipe(minifycss())
+			.pipe(rename({suffix:'.min'}))
+			.pipe(gulp.dest('./dist'))
+			.pipe(css2js()),
+		js
+	).pipe(concat('duoshuo-ua-with-css.js'))
+	.pipe(uglify())
+	.pipe(rename({suffix:'.min'}))
+	.pipe(gulp.dest('./dist'));
+});

+ 24 - 0
package.json

@@ -0,0 +1,24 @@
+{
+  "name": "duoshuo-ua",
+  "version": "1.0.0",
+  "title": "Duoshuo UA Plugin",
+  "description": "Plugin of duoshuo to show operating systems and browsers for duoshuo comments.",
+  "author": "Gerald <gera2ld@163.com>",
+  "repository": {
+    "type": "git",
+    "url": "git@git.oschina.net:gerald/duoshuo-ua.git"
+  },
+  "bugs": {
+    "url": "http://git.oschina.net/gerald/duoshuo-ua/issues"
+  },
+  "devDependencies": {
+    "gulp": "^3.8.10",
+    "gulp-concat": "^2.4.3",
+    "gulp-css2js": "^1.0.2",
+    "gulp-merge": "^0.1.0",
+    "gulp-minify-css": "^0.4.4",
+    "gulp-rename": "^1.2.0",
+    "gulp-uglify": "^1.1.0",
+    "gulp-wrap": "^0.10.1"
+  }
+}