diff --git a/.gitignore b/.gitignore index 03a2720..be25a54 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,7 @@ node_modules .grunt .DS_Store +**/*.swp dep asset doc/api diff --git a/Gruntfile.js b/Gruntfile.js index 4c31604..88f7cfd 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -1,6 +1,5 @@ module.exports = function (grunt) { - var build_prefix = grunt.option('prefix') || 'ecomui'; var pkg = grunt.file.readJSON('package.json'); grunt.initConfig({ @@ -10,29 +9,52 @@ module.exports = function (grunt) { src: { main: 'src', test: 'test/spec' - } + }, + cssPrefix: 'seui', + buildPrefix: 'ui', + version: pkg.version }, clean: { before: ['asset', 'bin'], - after: ['src/moye'], - afterdoc: ['example/css'] + after: ['src/moye', 'asset/moye/css'], + afterdoc: ['example/css'], + //真实上线后。lib已经和Control合并,并且paths已经配置lib->Control,所以 + //编译完成后,直接删除lib.js + //config同上 + 'after-online': [ + 'asset/online/ui/lib.js', + 'asset/online/ui/config.js', + 'asset/online/css' + ] }, jshint: { options: grunt.file.readJSON('.jshintrc'), - files: ['<%=meta.src.main%>/ui/*.js', '<%=meta.src.test%>/*.js'] + files: ['<%=meta.src.main%>/moye/*.js', '<%=meta.src.test%>/*.js'] }, less: { compile: { files: [{ expand: true, - cwd: 'src/css', + cwd: 'src/moye/css', src: '*.less', dest: 'asset/css', ext: '.css' }] + }, + online: { + options: { + compress: true + }, + files: [{ + expand: true, + cwd: 'src/moye/css', + src: '*.less', + dest: 'asset/online/ui', + ext: '.css' + }] } }, @@ -44,11 +66,11 @@ module.exports = function (grunt) { }, lesslint: { - src: ['src/**/*.less'] + src: ['src/moye/**/*.less'] }, jsdoc : { - files: ['src/**/*.js'], + files: ['src/moye/*/*.js'], options: { configure: '.jsdocrc', destination: 'doc/api' @@ -66,11 +88,19 @@ module.exports = function (grunt) { }, copy: { - build: { + js: { expand: true, cwd: '<%=meta.src.main%>/ui', src: '**', - dest: '<%=meta.src.main%>/moye/' + build_prefix, + dest: '<%=meta.src.main%>/moye/ui', + flatten: false, + filter: 'isFile', + }, + css: { + expand: true, + cwd: '<%=meta.src.main%>/css', + src: '**', + dest: '<%=meta.src.main%>/moye/css', flatten: false, filter: 'isFile', }, @@ -108,12 +138,35 @@ module.exports = function (grunt) { generateSourceMaps: false, optimize: 'uglify2'/*, modules: [ - {name: build_prefix + '/Calendar'}, - {name: build_prefix + '/City'} + {name: 'Calendar'}, + {name: 'City'} ]*/ } }, + online: { + options: { + baseUrl: '<%=meta.src.main%>/moye', + dir: 'asset/online/', + skipDirOptimize: false, + preserveLicenseComments: false, + generateSourceMaps: false, + optimize: 'uglify2', + modules: [ + {name: '<%= meta.buildPrefix%>/Control'}, + ] + } + }, + karma: { + options: { + configFile: 'test/config.js', + reporters: 'dots', + singleRun: true + }, + dev: { + browsers: ['Chrome', 'Firefox'] + } + } }, connect: { @@ -138,16 +191,27 @@ module.exports = function (grunt) { template: require('grunt-template-jasmine-requirejs'), templateOptions: { requireConfig: { - baseUrl: './<%=meta.src.main%>/', + baseUrl: './<%=meta.src.main%>/moye', urlArgs: '?' + (+new Date).toString(36) } } } }, + online: { + src: './asset/online/ui/*.js', + options: { + outfile: 'SpecRunner.html', + keepRunner: true, + specs: 'test/spec/*Spec.js', + vendor: [], + host: 'http://localhost:<%= connect.test.options.port %>', + template: 'test/templates/OnlineRunner.tmpl' + } + }, istanbul: { - src: './<%=meta.src.main%>/*/*.js', + src: './<%=meta.src.main%>/moye/ui/*.js', options: { - specs: ['test/spec/*Spec.js'], + specs: '<%= jasmine.requirejs.options.specs %>', vendor: [], outfile: 'SpecRunner.html', keepRunner: true, @@ -161,24 +225,14 @@ module.exports = function (grunt) { template: require('grunt-template-jasmine-requirejs'), templateOptions: { requireConfig: { - baseUrl: '.grunt/grunt-contrib-jasmine/<%= meta.src.main %>/', + baseUrl: '.grunt/grunt-contrib-jasmine/<%= meta.src.main %>/moye', urlArgs: '?' + (+new Date).toString(36) } } } } } - }, - karma: { - options: { - configFile: 'test/config.js', - reporters: 'dots', - singleRun: true - }, - dev: { - browsers: ['PhantomJS'] - } }, 'gh-pages': { @@ -186,7 +240,30 @@ module.exports = function (grunt) { base: './', message: 'Auto-generated commit by grunt' }, - src: ['doc/api/*', 'example/**', 'src/*/*'] + src: ['doc/api/*', 'example/**', 'src/moye/*/*'] + }, + + 'join-css-js': { + online: { + files: [{ + expand: true, + cwd: 'asset/online/ui', + src: '*.js' + }] + } + }, + + 'tmpl': { + build: { + files:[ + { + expand: true, + src: '**/config.*', + cwd: '<%=meta.src.main%>/moye/', + filter: 'isFile', + } + ] + } } }); @@ -202,12 +279,57 @@ module.exports = function (grunt) { } ); + //合并组件的js、css文件,这样模板开发者就不用再关心css的引入问题 + grunt.registerMultiTask('join-css-js', 'join ui css and js', function(){ + this.files.forEach(function(file){ + var files = file.src.filter(function(filePath) { + var cssPath = filePath.replace(/\.js$/, '.css'); + if (!grunt.file.exists(filePath) || !grunt.file.exists(cssPath)) { + return false; + } else { + return true; + } + }).map(function(filePath) { + var cssPath = filePath.replace(/\.js$/, '.css'); + var js = grunt.file.read(filePath), + css = grunt.file.read(cssPath); + var content = "A.addCssText(" + JSON.stringify(css) + ");"; + content += js; + grunt.file.write(filePath, content); + grunt.file.delete(cssPath); + grunt.log.writeln('join-css-js: ' + filePath); + return filePath; + }); + }); + debugger; + }); + + + //将文件作为模板处理,变量变量使用meta信息,用于替换一些常量 + grunt.registerMultiTask('tmpl', 'process file as a template using meta data', function(){ + this.files.forEach(function(file){ + file.src.forEach(function(filePath){ + var meta = grunt.config('meta'); + var tpl = grunt.file.read(filePath), + content = grunt.util._.template(tpl, meta); + grunt.file.write(filePath, content); + grunt.log.writeln('tmpl: ' + filePath); + }); + }); + }); + + + grunt.registerTask('base', ['clean:before', 'copy:js', 'copy:css', 'tmpl', 'jshint', 'lesslint', 'less:compile', 'csslint']); + grunt.registerTask('base-online', ['clean:before','copy:js', 'copy:css', 'tmpl', 'jshint','lesslint', 'csslint']); - grunt.registerTask('base', ['clean:before', 'jshint', 'lesslint', 'less', 'csslint']); - grunt.registerTask('build', ['base', 'copy:build', 'requirejs:build', 'clean:after']); + grunt.registerTask('build', ['base', 'requirejs:build', 'clean:after']); grunt.registerTask('test', ['base', 'connect', 'jasmine:requirejs']); grunt.registerTask('cover', ['base', 'connect', 'jasmine:istanbul']); grunt.registerTask('default', ['base']); - grunt.registerTask('page', ['less', 'copy:doc', 'jsdoc', 'gh-pages', 'clean:afterdoc']); + grunt.registerTask('example', ['copy:js', 'copy:css', 'tmpl', 'less', 'copy:doc']); + grunt.registerTask('page', ['example', 'jsdoc', 'gh-pages', 'clean:afterdoc']); + grunt.registerTask('build-online', ['base-online', 'requirejs:online', 'less:online', + 'join-css-js:online', 'clean:after', 'clean:after-online']); + grunt.registerTask('test-online', ['build-online', 'connect', 'jasmine:online']); } diff --git a/example/Calendar.html b/example/Calendar.html index 2f97101..c5e3344 100644 --- a/example/Calendar.html +++ b/example/Calendar.html @@ -25,7 +25,7 @@ (function () { require.config({ - baseUrl: '../src/ui' + baseUrl: '../src/moye/ui' }); require(['lib', 'Calendar'], function (lib, Calendar) { diff --git a/example/CalendarExtension.html b/example/CalendarExtension.html index b992c6b..2eeb4a4 100644 --- a/example/CalendarExtension.html +++ b/example/CalendarExtension.html @@ -25,7 +25,7 @@ (function () { require.config({ - baseUrl: '../src/ui' + baseUrl: '../src/moye/ui' }); require(['lib', 'CalendarExtension'], function (lib, CalendarExtension) { diff --git a/example/City.html b/example/City.html index 4af7a4a..28f12f8 100644 --- a/example/City.html +++ b/example/City.html @@ -22,7 +22,7 @@ (function () { require.config({ - baseUrl: '../src/ui' + baseUrl: '../src/moye/ui' }); require(['lib', 'City'], function (lib, City) { diff --git a/example/Dialog.html b/example/Dialog.html index c51029f..8fdc517 100644 --- a/example/Dialog.html +++ b/example/Dialog.html @@ -53,7 +53,7 @@ + + + + +
+ +
+ + + → + +
+
+
+ + + + + diff --git a/example/imaZoom.html b/example/imaZoom.html new file mode 100644 index 0000000..c80863c --- /dev/null +++ b/example/imaZoom.html @@ -0,0 +1,222 @@ +重庆长安金牛星车价与配置_百度搜索
kpingcherry
|消息|搜索设置|百度首页
  • 百度和中消协提示:如您在百度含信誉标识的搜索结果中因假冒官网、资质或钓鱼诈骗蒙受经济损失,可获百度先行保障。(登录百度账号保护您的权益)

推广链接
长安金牛星报价-搜狐汽车重庆4S店,放心购车,钜惠价格!auto.sohu.com
搜狐汽车重庆4S店提供更准确的长安金牛星报价全新报价,车源信息,优惠活动.
长安金牛星汽车货车可上京牌,最高可享1800元大礼包-金牛星售价host.35.com
来店客户送300元代金卷2000元装饰大礼包联系人张经理:13391961483

重庆长安金牛星优惠0.1万元 现车在售_金牛星_重庆车市-网上车市

2013年6月17日 -  【网上车市重庆站讯】近日,编辑从重庆地区长安经销商处获悉,2013年06月17日-2013年06月30日,2011款长安金牛星车型有少量现车在售,购车可优惠0.1...
news.cheshi.com/201306... 2013-06-17 
 - 百度快照

重庆金牛星经销商大全_4S店-网上车市

网上车市重庆金牛星4S店提供重庆长安金牛星4S店综合信息,包括重庆金牛星4S店店面地址,联系电话,报价信息等详细内容.
seller.cheshi.com/chon... 2014-07-11 
 - 百度快照

重庆金牛星经销商报价|长安金牛星重庆4s店-网上车市

长安 长安商用车- 金牛星 全部 |2013款 |2011款 综述 报价 降价 图片 参数配置 评测/行情 点评 油耗 车贷 经销商 二手车 更多 ...
product.cheshi.com/bse... 2012-03-08 
 - 百度快照 - 评价

长安金牛星长安金牛星报价_长安金牛星价格_参数_图片_商车网

金牛星 金牛星(长安金牛星)所属企业:重庆长安汽车股份有限公司综述 车型 文章 论坛 经销商 售后服务站金牛星(长安金牛星) 金牛星品牌简介 ...
www.cn357.com/brand635_1 2014-07-18 
 - 百度快照

【图文】长安金牛星车型最高可补贴车价10%_新闻中心_易车网

2012年8月6日 - 长安金牛星车型最高可补贴车价10% 【 易车网柳州讯 】近日易车网编辑从柳州长安商用万友4S店处了解到,广西万
news.bitauto.com/guoch... 2012-08-06 
 - 百度快照

长安金牛星医疗救护车价格|厂家|配置|图片 - 冷藏车|疫苗运输车|...

长安金牛星医疗救护车:长安金牛星医疗救护车是采用长安金牛星面包车SC6418B4底盘改装而成,配以JL474QE汽油发动机,1.3排量高性能,功率为67.5KW(92 马力)百公里...
www.hbjnhw.com/New-2..... 2012-11-16 
 - 百度快照

长安金牛星车型介绍】_最新报价_外观_内饰_图片_搜狐汽车

搜狐汽车为你提供长安金牛星相关的报价、参数、评测、图片、配置、资讯、油耗、满意度等最全面的信息,以及长安金牛星论坛交互信息;想知道长安金牛星怎么样?就上搜狐...
db.auto.sohu.com/model... 2012-06-10 
 - 百度快照

长安金牛星 - 东莞汽车城网 东莞专业购车网(www.goicar.com)

长安金牛星 月供按揭净车价:3.99万元 包牌价:4.65万元 车型资料 订购此车...重庆长安汽车股份有限公司具有随时更改型号、规格、配置、车身颜色的权利,恕不另行...
www.goicar.com/agency4... 2012-06-01 
 - 百度快照

【图】金牛星价格_金牛星多少钱_长安汽车_汽车之家

金牛星 车系频道 | 图片 | 配置 | 论坛 | 二手车 | 口碑 长安商用 金牛星 级别:微面 车身结构:客车 发动机:1.2L 1.3L 变速箱:手动 指导价:4.59...
car.autohome.com.cn/pr... 2012-10-30 
 - 百度快照

金牛星 2011款】长安商用_金牛星 2011款报价_金牛星 2011款论坛...

抢先实拍长安新一代高级微客——金牛星11-17 2011款金牛星车款 全部在售|... 金牛星参数配置 金牛星图片 金牛星车型详解 金牛星报价 金牛星二手车 金牛星...
car.bitauto.com/jinniu... 2014-01-21 
 - 百度快照
推广链接
长安金牛星报价-搜狐汽车重庆4S店,放心购车,钜惠价格!auto.sohu.com
搜狐汽车重庆4S店提供更准确的长安金牛星报价全新报价,车源信息,优惠活动.
长安金牛星汽车货车可上京牌,最高可享1800元大礼包-金牛星售价host.35.com
来店客户送300元代金卷2000元装饰大礼包联系人张经理:13391961483

12345678910下一页>百度为您找到相关结果约34,000,000个

+ + diff --git a/example/log.html b/example/log.html index e255a05..d680ebb 100644 --- a/example/log.html +++ b/example/log.html @@ -27,7 +27,7 @@ + + + + +<% with (scripts) { %> + <% [].concat(polyfills, jasmine, vendor, helpers, reporters, start).forEach(function(script){ %> + + <% }) %> + +<% }; %> + + + + +