Grails 巴贝尔资产管道1.3.1不工作?
我一辈子都不能让这条资产管道运作起来 我补充说:Grails 巴贝尔资产管道1.3.1不工作?,grails,asset-pipeline,babeljs,Grails,Asset Pipeline,Babeljs,我一辈子都不能让这条资产管道运作起来 我补充说: compile ":babel-asset-pipeline:1.3.1" 到我的BuildConfig.groovy 以及: 到我的Config.groovy 在我的application.js中,我只有: // This is a manifest file that'll be compiled into application.js. // // Any JavaScript file within this directory can
compile ":babel-asset-pipeline:1.3.1"
到我的BuildConfig.groovy
以及:
到我的Config.groovy
在我的application.js中,我只有:
// This is a manifest file that'll be compiled into application.js.
//
// Any JavaScript file within this directory can be referenced here using a relative path.
//
// You're free to add application-wide JavaScript to this file, but it's generally better
// to create separate JavaScript files as needed.
//
//= require jquery
//= require_tree .
//= require_self
if (typeof jQuery !== 'undefined') {
(function($) {
$('#spinner').ajaxStart(function() {
$(this).fadeIn();
}).ajaxStop(function() {
$(this).fadeOut();
});
})(jQuery);
}
class Test {
render() {
return (
"TEST"
);
}
}
应将其转换为:
// This is a manifest file that'll be compiled into application.js.
//
// Any JavaScript file within this directory can be referenced here using a relative path.
//
// You're free to add application-wide JavaScript to this file, but it's generally better
// to create separate JavaScript files as needed.
//
//= require jquery
//= require_tree .
//= require_self
'use strict';
var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }
if (typeof jQuery !== 'undefined') {
(function ($) {
$('#spinner').ajaxStart(function () {
$(this).fadeIn();
}).ajaxStop(function () {
$(this).fadeOut();
});
})(jQuery);
}
var Test = (function () {
function Test() {
_classCallCheck(this, Test);
}
_createClass(Test, [{
key: 'render',
value: function render() {
return "TEST";
}
}]);
return Test;
})();
//这是一个清单文件,将被编译成application.js。
//
//可以使用相对路径在此处引用此目录中的任何JavaScript文件。
//
//您可以自由地向该文件添加应用程序范围的JavaScript,但通常情况下会更好
//根据需要创建单独的JavaScript文件。
//
//=需要jquery
//=需要一棵树。
//需要自己
"严格使用",;
var_createClass=(function(){function defineProperties(target,props){for(var i=0;i
根据这个在线工具
但我的application.js似乎从未被处理过。怎么了?我刚刚合并了一个关于该问题的请求。 事实上,文件是错误的。资产配置的命名空间不是grails.asset,而是grails.assets 因此,如果您将配置更新为
grails.assets.babel.enabled = true
grails.assets.babel.processJsFiles = true
应该行得通
grails.assets.babel.enabled = true
grails.assets.babel.processJsFiles = true