Mini scripts using GruntJs

I have several js files which, it seems to me, can cause GruntJs to execute / reduce correctly.

If I do each separately, they work fine.

If I combine separately, then I will try to minimize only the combined file, it also does not work.

Here is the error:
enter image description here

Any ideas on how to fix this? Or maybe what causes it?

+3
source share
3 answers

There is currently a problem with GruntJs and the spec mentioned in the comment of Derick's answer.

You can find this problem here: https://github.com/cowboy/grunt/issues/218#issuecomment-6329807

In Visual Studio, manually delete the specification

Go to File> File> Advanced Save Options> Set the encoding to "Unicode without signature"> "Ok" This should delete it.

+4
source

To clarify and make sure I understand:

  • You have 2 separate files. We will call them File1 and File2
  • If you minimize File1 yourself, it works great
  • If you minimize File2 yourself, it works great
  • If you combine the files File1 and File2 together, then minify, you will get this error.

Is it correct?

If so, you probably have a missing semicolon and the errors caused by ASI (automatic insert insertion) are executing.

(note that this assumption is based on the limited information you provided. You will need to post a lot more information about files, code, etc., to really give a better answer)

+3
source

When concatenating File1 and File2, you need to add seperator: ';' in your parameters

For example,

concat : { options : { seperator :';' }, dist : { src : [ 'path/to/src/*.js'], dest : 'path/to/dest.js' } } 
0
source

All Articles