Menu icon Foundation
Foundation 6.2 gulp-uglify gives error on '`'

I installed 6.2 using my usual npm process. When I execute gulp-concat and gulp-uglify my js throws up an error on `'`

Basically it looks like 6.2 has a bunch of ` where they used to be '

This is not the case with my 6.1.2 js files.

Example, in 6.2 search for ` in node_modules/foundation-sites/js/foundation.core.js

there are 34 ` characters in comments and in the code and the code ones were ' in 6.1.2

Is this an error in the npm source?

6.2gulp-uglifyFoundation 6.2npm

I installed 6.2 using my usual npm process. When I execute gulp-concat and gulp-uglify my js throws up an error on `'`

Basically it looks like 6.2 has a bunch of ` where they used to be '

This is not the case with my 6.1.2 js files.

Example, in 6.2 search for ` in node_modules/foundation-sites/js/foundation.core.js

there are 34 ` characters in comments and in the code and the code ones were ' in 6.1.2

Is this an error in the npm source?

Chris almost 4 years ago

It'll be tough to tell without seeing your code. If you're using Gulp try adding gulp-util to get some logs going. Ideally something like this should work:

gulp.task('foundation', function() {
    return gulp.src(foundationPaths)
	.pipe($.babel()) //transpile first
	.pipe($.concat('foundation.min.js'))
	.pipe($.uglify().on('error', $.util.log))
	.pipe(gulp.dest('./js'));
});

R G Osborne almost 4 years ago

Chris,

 

I'm having similar problems, and I followed the upgrade instructions to the letter.  Is Babel choking on already minimized JS?


Chris almost 4 years ago

You'll need to transpile those template strings using Babel.  See here:

https://github.com/zurb/foundation-sites/wiki/Upgrading-to-Foundation-6.2

Daniel Woodard almost 4 years ago

The grave ` is in the github repo for 6.2 as well.

https://github.com/zurb/foundation-sites/blob/develop/js/foundation.core.js

 

lines 56 and 57 for example

if(!plugin.$element.attr(`data-${pluginName}`)){ plugin.$element.attr(`data-${pluginName}`, plugin.uuid); }
if(!plugin.$element.data('zfPlugin')){ plugin.$element.data('zfPlugin', plugin); }

 

 

Dani Castaños almost 4 years ago

+1