【问题标题】:gruntjs - jquery-ui-touch-punch not working in grunt prod on iPadgruntjs - jquery-ui-touch-punch 在 iPad 上的 grunt prod 中不起作用
【发布时间】:2014-01-01 10:31:05
【问题描述】:

我有一个使用 reuire、backbone、jquery、jquery-ui、jquery-ui-touch-punch 和hammer 开发的应用程序。

应用程序有两部分:<li> 可拖动元素和<div> 可放置区域。用例是将<li> 拖放到<div> 上。 <div> 用作具有缩放和平移功能的时间线。

缩放和平移是使用hammer.js 实现的,可以在iPad 上很好地工作。对于桌面浏览器,它是使用mousewheelmousedown 事件实现的。

当我使用grunt dist:local -force 构建应用程序时,它在桌面和 iPad 浏览器上运行良好。但是当我使用grunt dist:prod -force 构建它时,它在桌面浏览器上运行良好,但在 iPad 上停止拖动 jquery-ui 元素。

请在下面找到配置文件。

requirejs.config({
  shim: {
    jquery: {
      exports: '$'
    },
    underscore:{
        exports: '_'
    },
    backbone:{
        deps    : ['jquery', 'underscore'],
        exports : 'Backbone'
    },
    createjs: {
        exports : 'createjs'
    },
    d3:{
        deps    : ['jquery', 'underscore'],
        exports : 'd3'
    },
    sinon: {
        exports : 'sinon'
    },
    'jquery-ui': {
        deps   : ['jquery'],
        exports : '$'
    },
    'jquery-ui-core': {
        deps   : ['jquery'],
        exports : '$'
    },
    'jquery-ui-widget': {
        deps   : ['jquery-ui-core'],
        exports : '$'
    },
    'jquery-ui-mouse': {
        deps   : ['jquery-ui-widget'],
        exports : '$'
    },
    'jquery-ui-slider': {
        deps   : ['jquery-ui-core', 'jquery-ui-widget', 'jquery-ui-mouse'],
        exports : '$'
    },
    'touch-punch': {
       deps   : ['jquery-ui-core', 'jquery-ui-widget', 'jquery-ui-mouse'],
       exports : '$'
    },

    'transitjs' : {
        deps: ['jquery'],
        exports: '$'
    },
    hammerjs: {
        exports : 'Hammer'
    }
},
  paths: {
    env         : 'environment/local',

    text        : '../../../bower_components/requirejs-text/text',

    jquery      : '../../../bower_components/jquery/jquery',
    'jquery-ui' : "../../../bower_components/jquery-ui/ui/jquery-ui",
    'jquery-ui-core' : "../../../bower_components/jquery-ui/ui/jquery.ui.core",
    'jquery-ui-widget' : "../../../bower_components/jquery-ui/ui/jquery.ui.widget",
    'jquery-ui-mouse' : "../../../bower_components/jquery-ui/ui/jquery.ui.mouse",
    'jquery-ui-slider': "../../../bower_components/jquery-ui/ui/jquery.ui.slider",
    underscore  : '../../../bower_components/underscore/underscore',
    backbone    : '../../../bower_components/backbone/backbone',
    check       : '../../../bower_components/check-js/check.min',
    d3          : '../../../bower_components/d3/d3.min',
    createjs    : '../../../bower_components/createjs/index', 


    'astro-lib': "../../../bower_components/astro-lib/app/scripts/astro-lib",
    'histogramjs': "../../../bower_components/histogramjs",
    'transitjs': "../../../bower_components/transitjs/jquery.transit",   
    'sinon'       : "../../../test/libs/sinon-1.4.2",

    'hammerjs'    : "../../../bower_components/hammerjs/dist/hammer.min",

    'touch-punch':"../../../bower_components/jqueryui-touch-punch/jquery.ui.touch-punch"//,

    //'polyfill-typedarray'    : "../../../bower_components/polyfill/typedarray"
  }
});

bower.json

{
  "name": "timescaler",
  "version": "0.1.0",
  "dependencies": {
    "jquery": "1.8.3",
    "requirejs": "~2",
    "requirejs-text": "~2",
    "mocha": "~1.6",
    "chai": "~1.3",
    "chai-jquery": "~1.1.1",
    "almond": "~0.2",
    "backbone": "~0.9.2",
    "jquery-ui": "~1.10.3",
    "underscore": "~1.4.2",  
    "check-js": "~0.1.0",
    "flat-ui-official": "",
    "font-awesome": "~3.2.1",
    "d3":"~3.2.7",
    "createjs": "http://code.createjs.com/createjs-2013.02.12.min.js",
    "jqueryui-touch-punch": "",    
    "hammerjs": "~1.0.5",
    "polyfill": "https://github.com/inexorabletash/polyfill.git",
    "astro-lib": "git@github.com:SmartSparrow/astro-lib.git",
    "pipit": "https://github.com/SmartSparrow/pipit-js.git"
  }
}

grunt dist:prod -force 上的 jquery-ui-touch-punch 有什么问题吗?为什么在桌面浏览器上使用 grunt dist:local -force 可以正常工作?

【问题讨论】:

  • 我们需要查看你的 gruntfile 来判断它是否有问题。
  • 这是订购在页面上添加jquery-uitouch-punch的问题。我在jquery-ui 之前添加了touch-punch,所以它在grunt dist:prod 中不起作用。

标签: ipad jquery-ui gruntjs


【解决方案1】:

这是在页面上添加jquery-uitouch-punch 的问题。我在jquery-ui 之前添加了touch-punch,所以它在grunt dist:prod 中不起作用。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2015-06-20
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-06-02
    • 1970-01-01
    • 2019-10-23
    相关资源
    最近更新 更多