samedi 28 janvier 2017

Trying to config Dropzone after being webpacked

I've dropzone.js webpacked with elixir and I'm trying to set some vars through my view but I'm getting

(index):172 Uncaught ReferenceError: Dropzone is not defined at (index):172

But dropzone is loaded and working, any idea about how to fix that?.

Note: If I enter "dropzone" on developer console I get the same error.

My view:

<script type="text/javascript" src=""></script>
    <script>
        /**
         * Seteamos la configuración de Dropzone
         *
         */
            Dropzone.options.dropzoneArea = {
                maxFilesize: , // MB
                addRemoveLinks: true,
                acceptedFiles: '.',
                maxFiles: ,
                dictDefaultMessage: '@lang('validation.dictDefaultMessage')',
                dictFallbackMessage: '@lang('validation.dictFallbackMessage')',
                dictFallbackText: '@lang('validation.dictFallbackText')',
                dictInvalidFileType: '@lang('validation.dictInvalidFileType')',
                dictFileTooBig: '@lang('validation.dictFileTooBig')',
                dictResponseError: '@lang('validation.dictResponseError')',
                dictCancelUpload: '@lang('validation.dictCancelUpload')',
                dictCancelUploadConfirmation: '@lang('validation.dictCancelUploadConfirmation')',
                dictRemoveFile: '@lang('validation.dictRemoveFile')',
                dictMaxFilesExceeded: '@lang('validation.dictMaxFilesExceeded')',
                success: function (file, response) {
                    /**
                     * Seteamos el ID para que sean identificables los uploads.
                     */
                    $(".post_id").val(response.post_id);
                }
            };

    </script>

My gulpfile.js

const elixir = require('laravel-elixir');
require('laravel-elixir-minify-html');

/*
 |--------------------------------------------------------------------------
 | Elixir Asset Management
 |--------------------------------------------------------------------------
 |
 | Elixir provides a clean, fluent API for defining some basic Gulp tasks
 | for your Laravel application. By default, we are compiling the Sass
 | file for your application as well as publishing vendor resources.
 |
 */

elixir(function (mix) {

    mix
        .sass('app.scss')
        .sass('dropzone.scss')
        .webpack(['app.js', 'dropzone.js'])
        .version(['css/app.css', 'css/dropzone.css', 'js/all.js'])
        .copy('node_modules/bootstrap-sass/assets/fonts/bootstrap', 'public/build/fonts/bootstrap');

});



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire