在浏览器中使用Greensock [英] Using greensock with browserify

查看:86
本文介绍了在浏览器中使用Greensock的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我无法让TweeLite与browserify一起使用。在CommonJS方面,我是一个极端的菜鸟。

I'm not able to get TweeLite to work with browserify. I'm an extreme noob when it comes to CommonJS.

我已经使用Bower安装了gasp v1.13.2,并包含了这样的内容:

I've installed gasp v1.13.2 using Bower and include it like this:

var TweenLite = require("../../bower_components/gsap/src/minified/TweenLite.min.js");

使用它时我没有出现任何错误,但是我的动画无法正常工作。根据gsap docs的说法,此版本无需使用填充程序即可运行。我究竟做错了什么?谁能提供一个有效的示例?

I don't get any errors when using it, but my animations don't work. According to gsap docs this version should work without a shim. What am I doing wrong? Can anyone provide a working example?

https ://greensock.com/gsap-1-13-1

我刚开始一个项目,所以没有任何有趣的代码可以显示。我正在使用 gulp-starter 样板。

I've just started on a project so I dont have any interesting code to show. I'm using the gulp-starter boilerplate.

推荐答案

尝试使用未压缩的GSAP库。我已经通过 browserify 成功使用了它们,并安装了 bower 。像这样:

Try using the uncompressed GSAP libraries. I'm successfully using them through browserify and installed with bower. Like this:

var TweenLite = require('../bower_components/gsap/src/uncompressed/TweenLite.js');
var TimelineLite = require('../bower_components/gsap/src/uncompressed/TimelineLite.js');
var CSSPlugin = require('../bower_components/gsap/src/uncompressed/plugins/CSSPlugin.js');

但是,如果我切换到压缩版本 browserify 不再找到模块。

However, if I switch to the compressed builds browserify no longer finds the modules.

似乎用于生成精简版本的压缩方法以某种方式破坏了模块的导出。

It appear like the compression methods used to generate the minified builds somehow broke the module exports.

这篇关于在浏览器中使用Greensock的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆