olefredrik / FoundationPress

FoundationPress is a WordPress starter theme based on Foundation 6 by Zurb
https://foundationpress.olefredrik.com
MIT License
2.71k stars 871 forks source link

npm run build doesn't build the files correctly #1387

Closed dgobnto closed 5 years ago

dgobnto commented 5 years ago

How can this bug be reproduced?

  1. Build files for production with npm run build

What did you expect to happen?

Built files to work normally

What happened instead?

One of the js files throws a "ReferenceError: a is not defined". npm run dev builds the files correctly.

init-works.js

import $ from 'jquery';
import Cookies from 'js-cookie';

var loading = $('.work-loading');
function init_works() {
    loading.fadeToggle(400, 'linear');
    if (!Cookies.get('works-view') || 'list' === Cookies.get('works-view')) {
        $('.work-content').removeClass('works-view-grid').addClass('works-view-list');
        $('.work-thumbnail').addClass('dropdown-pane').removeAttr('style');
        Foundation.reInit('dropdown');
    } else if ('grid' === Cookies.get('works-view')) {
        $('.work-thumbnail').foundation('_destroy');
        $('.work-thumbnail').removeClass('dropdown-pane');
        $('.work-content').removeClass('works-view-list').addClass('works-view-grid');
    }
}

$(document).ready(function() {
    init_works();
});

$('#works-view-switch').click(function() {
    loading.toggle();
    if (!Cookies.get('works-view') || 'list' === Cookies.get('works-view')) {
        Cookies.set('works-view', 'grid');
    } else if ('grid' === Cookies.get('works-view')){
        Cookies.set('works-view', 'list');
    }
    init_works();
});

Please List the Following: