Roots Discourse

Grunt doesn't uglify

I downloaded the latest Roots from github. I don’t use it with Bedrock. I noticed that in Gruntfile.js there is:

uglify: {
  dist: {
    files: {
      'assets/js/scripts.min.js': [jsFileList]
    }
  }
},

But after launching grunt it doesn’t compile any scripts.min.js in the path assets/js/. Also I noticed that the lib/scripts.php file doesn’t load scripts.min.js but scripts.js (not uglified)

'js'        => '/assets/js/scripts.js',

Some explanations?

Please use the search function, this has been explained thoroughly throughout the site and the documentation.

Hi @cfx
sorry but I didn’t find any explanations… neither on the forum nor in the official docs. Can gently help me or give me a link? Thanks

See this post: Add x.min.css & x.min.script to watch

You can see in Gruntfile.js that only the build task runs uglify: https://github.com/roots/roots/blob/master/Gruntfile.js#L167

Ok, here is what I understand: I use grunt watch for development case (‘dev’ task, this doesn’t uglify). When I want to build I launch grunt build.

Then, last one question: roots theme is configured to load scripts.js (not uglified) but in deploy case (‘build’ task) I will have scripts.min.js. I need to change manually the file name in lib/scripts.php ?

That is also answered in the thread I referenced.