Skip to content

Commit

Permalink
加入grunt,修复zepto可能导致的css字符串中有[object CSSStyleDeclaration]
Browse files Browse the repository at this point in the history
加入grunt,修复zepto可能导致的css字符串中有[object CSSStyleDeclaration]的问题
  • Loading branch information
jieyou committed Apr 8, 2014
1 parent 5ed0f19 commit dd76a5a
Show file tree
Hide file tree
Showing 5 changed files with 47 additions and 4 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node_modules/*
32 changes: 32 additions & 0 deletions Gruntfile.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
module.exports = function(grunt){

grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
jshint:{
options:{
asi:true,
laxcomma:true,
laxbreak:true
},
all:['flexibleWapHelper.js']
},
uglify: {
options: {
banner: '/*!\n'
+ ' * author:jieyou\n'
+ ' * contacts:baidu hi->youyo1122\n'
+ ' * see https://github.com/jieyou/flexibleWapHelper\n'
+ ' */\n'
},
build: {
src:'flexibleWapHelper.js',
dest:'flexibleWapHelper.min.js'
}
}
});

grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-contrib-uglify');

grunt.registerTask('default', ['jshint','uglify']);
}
5 changes: 3 additions & 2 deletions flexibleWapHelper.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*!
* author:jieyou
* contacts:百度hi->youyo1122
* contacts:baidu hi->youyo1122
* see https://github.com/jieyou/flexibleWapHelper
*/
;(function($){
Expand Down Expand Up @@ -109,7 +109,8 @@
})
this.each(function(j,k){
var $k = that.eq(j),
curStyle = $k.attr('style')
// curStyle = $k.attr('style') // in zepto will return [object CSSStyleDeclaration]
curStyle = $k[0].getAttribute('style')
// all style has the same key -- `display`, so can not use .css({}) directly
$k.attr('style',curStyle?(curStyle + boxFlexCssStr):boxFlexCssStr)
})
Expand Down
4 changes: 2 additions & 2 deletions flexibleWapHelper.min.js

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

9 changes: 9 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"name": "remember.js",
"version": "0.1.0",
"devDependencies": {
"grunt": "~0.4.1",
"grunt-contrib-uglify" : "*",
"grunt-contrib-jshint" : "*"
}
}

0 comments on commit dd76a5a

Please sign in to comment.