Permalink
Browse files

Nix "replace" command, accomplish with new grunt-contrib-copy process…

…Content option.
  • Loading branch information...
1 parent 935a200 commit 3ba59ffbda788fac27e533019e80421ec32b9803 @davidkaneda davidkaneda committed Feb 15, 2013
Showing with 27 additions and 40 deletions.
  1. +26 −39 Gruntfile.coffee
  2. +1 −1 package.json
View
@@ -79,25 +79,43 @@ module.exports = (grunt) ->
copy:
prepare:
+ expand: true
+ src: ["*/**", "!{test,node_modules,build,submodules,jqtouch*}/**", "*.{md,txt,htaccess}"]
+ dest: "<%= dirs.build %>/"
+
+ dist:
files: [
- expand: true
- src: ["*/**", "!{test,node_modules,build,submodules}/**", "*.{md,txt}"]
- dest: "<%= dirs.build %>/"
+ expand: yes
+ dest: '<%= dirs.dist %>/'
+ src: '**/*'
+ cwd: '<%= dirs.build %>'
,
- src: "<%= dirs.dist %>/.htaccess"
- dest: "<%= dirs.dist %>/sample.htaccess"
+ src: "<%= dirs.build %>/sample.htaccess"
+ dest: "<%= dirs.dist %>/.htaccess"
]
- dist:
- files:
- "<%= dirs.dist %>/": ["<%= dirs.build %>/**"]
+ options:
+ processContent: (content, path) ->
+ if path.match /\.js$/
+ content.replace /\n\s*warn\(.*/g, ''
+ else if path.match /\.html$/
+ content.replace /([\w-\.]*)(\.min)?\.js/g, '$1.min.js'
+ else
+ content
zepto:
files:
"lib/zepto/": ["submodules/zepto/dist/**"]
"<%= dirs.build %>/src/jqtouch-jquery.js": ["submodules/zepto/src/touch.js"]
"jquery-bridge":
+ options:
+ # Convert Zepto's touch class to work for jQuery
+ processContent: (content) ->
+ content
+ .replace('e.touches', '(e.originalEvent||e).touches')
+ .replace('(Zepto)', '(jQuery)')
+
files:
"<%= dirs.build %>/src/jqtouch-jquery.js": ["submodules/zepto/src/touch.js"]
@@ -106,37 +124,6 @@ module.exports = (grunt) ->
"themes/css/": ["<%= dirs.dist %>/themes/css/**"]
"src/jqtouch-jquery.js": ["<%= dirs.dist %>/src/jqtouch-jquery.js"]
- replace:
- "jquery-bridge":
- src: ["<%= dirs.build %>/src/jqtouch-jquery.js"]
- overwrite: true
- replacements: [
- from: /e\.touches/g
- to: "(e.originalEvent || e).touches"
- ,
- from: /\(Zepto\)/g
- to: "(jQuery)"
- ]
-
- distpath:
- src: ["<%= dirs.dist %>/**/*.html"]
- overwrite: true
- replacements: [
- from: /([\w-\.]*)\.js/g
- to: "$1.min.js"
- ,
- from: /([\w-\.]*)\.min\.min\.js/g
- to: "$1.min.js"
- ]
-
- "strip-warnings":
- src: ["<%= dirs.dist %>/src/jqtouch.js", "<%= dirs.dist %>/src/jqtouch.min.js"]
- overwrite: true
- replacements: [
- from: /\n\s*warn\(.*/g
- to: ""
- ]
-
gitmodule:
zepto: {}
recipes:
View
@@ -40,8 +40,8 @@
"grunt-contrib-coffee": "~0.4.0",
"grunt-contrib-compress": "~0.4.0",
"grunt-contrib-concat": "~0.1.2rc6",
- "grunt-contrib-copy": "~0.4.0",
"grunt-contrib-lint": "~0.5.0",
+ "grunt-contrib-copy": "0.4.0rc7",
"grunt-contrib-mincss": "~0.4.0",
"grunt-contrib-jshint": "~0.1.0",
"grunt-css": "~0.5.3",

0 comments on commit 3ba59ff

Please sign in to comment.