Laravel:将咖啡脚本编译为一个文件

时间:2019-07-07 14:08:11

标签: laravel coffeescript laravel-5.8 mix

我对Coffeescript完全陌生,我从未在Laravel中使用过它。

我正在尝试将此插件:https://github.com/GetmeUK/ContentTools包含其中的咖啡文件,以便添加自己的扩展名。但是laravel中的.mix不允许我将所有.coffee文件合并为一个。相反,我尝试将每个.coffee文件编译为一个.js并将它们合并在一起,不用说这行不通。

我的尝试失败:

.coffee('plugins/editor/namespace.coffee', 'public/js/editor')
//UI
.coffee('plugins/editor/ui/ui.coffee', 'public/js/editor/ui')
.coffee('plugins/editor/ui/events.coffee', 'public/js/editor/ui')
.coffee('plugins/editor/ui/flashes.coffee', 'public/js/editor/ui')
.coffee('plugins/editor/ui/ignition.coffee', 'public/js/editor/ui')
.coffee('plugins/editor/ui/inspector.coffee', 'public/js/editor/ui')
.coffee('plugins/editor/ui/modal.coffee', 'public/js/editor/ui')
.coffee('plugins/editor/ui/toolbox.coffee', 'public/js/editor/ui')

//dialogs
.coffee('plugins/editor/ui/dialogs/dialogs.coffee', 'public/js/editor/ui/dialogs')
.coffee('plugins/editor/ui/dialogs/image.coffee', 'public/js/editor/ui/dialogs')
.coffee('plugins/editor/ui/dialogs/link.coffee', 'public/js/editor/ui/dialogs')
.coffee('plugins/editor/ui/dialogs/properties.coffee', 'public/js/editor/ui/dialogs')
.coffee('plugins/editor/ui/dialogs/table.coffee', 'public/js/editor/ui/dialogs')
.coffee('plugins/editor/ui/dialogs/video.coffee', 'public/js/editor/ui/dialogs')

//other
.coffee('plugins/editor/clean-html.coffee', 'public/js/editor')
.coffee('plugins/editor/editor.coffee', 'public/js/editor')
.coffee('plugins/editor/history.coffee', 'public/js/editor')
.coffee('plugins/editor/styles.coffee', 'public/js/editor')
.coffee('plugins/editor/tools.coffee', 'public/js/editor')


.scripts([
    'public/plugins/editor/content-edit.js',

    'public/js/editor/namespace.js',

    'public/js/editor/ui/ui.js',
    'public/js/editor/ui/events.js',
    'public/js/editor/ui/flashes.js',
    'public/js/editor/ui/ignition.js',
    'public/js/editor/ui/inspector.js',
    'public/js/editor/ui/modal.js',
    'public/js/editor/ui/toolbox.js',

    'public/js/editor/ui/dialogs/dialogs.js',
    'public/js/editor/ui/dialogs/image.js',
    'public/js/editor/ui/dialogs/link.js',
    'public/js/editor/ui/dialogs/properties.js',
    'public/js/editor/ui/dialogs/table.js',
    'public/js/editor/ui/dialogs/video.js',

    'public/js/editor/clean-html.js',
    'public/js/editor/editor.js',
    'public/js/editor/history.js',
    'public/js/editor/styles.js',
    'public/js/editor/tools.js',


], 'public/plugins/editor/content-tools.js')

我在“ npm run production”终端上遇到的错误:

Can't reference 'this' before calling super in derived class constructors
        if @table
           ^
    L5:         if @table
                    ^

那我如何将大量.coffee文件编译为一个文件?

0 个答案:

没有答案