bertramdev / grails-asset-pipeline

Grails Asset Pipeline

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Failing to compile assets when building war file

ShurikAg opened this issue · comments

Hi,
In my app, I have assets like boostrap, fontawesome, etc... that were installed through bower.
And I am including them like so:

/*
* This is a manifest file that'll be compiled into application.css, which will include all the files
* listed below.
*
* Any CSS file within this directory can be referenced here using a relative path.
*
* You're free to add application-wide styles to this file and they'll appear at the top of the
* compiled file, but it's generally better to create a new file per style scope.
*
*= require bootstrap/less/bootstrap
*= require font-awesome/less/font-awesome
*= require main
*= require rrm
*= require_self
*= encoding UTF-8
*/

If I run the app through grails run-app for any environment, everything works perfectly fine. However, if I am trying to build war file I am getting the following error:

Processing File 147 of 369 - bootstrap/js/popover.js
Uglifying File 147 of 369 - bootstrap/js/popover
Compressing File 147 of 369 - bootstrap/js/popover
Processing File 148 of 369 - bootstrap/js/scrollspy.js
Uglifying File 148 of 369 - bootstrap/js/scrollspy
Compressing File 148 of 369 - bootstrap/js/scrollspy
Processing File 149 of 369 - bootstrap/js/tab.js
Uglifying File 149 of 369 - bootstrap/js/tab
Compressing File 149 of 369 - bootstrap/js/tab
Processing File 150 of 369 - bootstrap/js/tooltip.js
Uglifying File 150 of 369 - bootstrap/js/tooltip
Compressing File 150 of 369 - bootstrap/js/tooltip
Processing File 151 of 369 - bootstrap/js/transition.js
Uglifying File 151 of 369 - bootstrap/js/transition
Compressing File 151 of 369 - bootstrap/js/transition
Processing File 152 of 369 - bootstrap/less/alerts.less
:assetCompile FAILED

FAILURE: Build failed with an exception.

  • What went wrong:
    Execution failed for task ':assetCompile'.

    java.lang.Exception: LESS Engine Compiler Failed - alerts.less:
    --Could not compile less. 21 error(s) occurred:
    ERROR 10:12 The variable "@alert-padding" was not declared.
    9: .alert {
    10: padding: @alert-padding;
    11: margin-bottom: @line-height-computed;

    ERROR 11:18 The variable "@line-height-computed" was not declared.
    10: padding: @alert-padding;
    11: margin-bottom: @line-height-computed;
    12: border: 1px solid transparent;

    ...

    Did you mean to compile this file individually (check docs on exclusion)?

  • Try:
    Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

Why is that, and how do I fix it?

Thanks,

alerts.less doesn’t compile individually. you should be configuring your excludes patterns to exclude “Partials” from your less. Typically i exclude using

assets {
excludes = [‘*/.less’]
incldues = [‘application.less’]
}

That way i exclude all less files from being individually processed but the main less file.

This goes in your build.grade file

Thanks,
David

On Mar 21, 2016, at 5:33 AM, Alex Agulyansky notifications@github.com wrote:

Hi,
In my app, I have assets like boostrap, fontawesome, etc... that were installed through bower.
And I am including them like so:

/*

  • This is a manifest file that'll be compiled into application.css, which will include all the files
  • listed below.
    *
  • Any CSS file within this directory can be referenced here using a relative path.
    *
  • You're free to add application-wide styles to this file and they'll appear at the top of the
  • compiled file, but it's generally better to create a new file per style scope.
    *
    *= require bootstrap/less/bootstrap
    *= require font-awesome/less/font-awesome
    *= require main
    *= require rrm
    *= require_self
    *= encoding UTF-8
    */
    If I run the app through grails run-app for any environment, everything works perfectly fine. However, if I am trying to build war file I am getting the following error:

Processing File 147 of 369 - bootstrap/js/popover.js
Uglifying File 147 of 369 - bootstrap/js/popover
Compressing File 147 of 369 - bootstrap/js/popover
Processing File 148 of 369 - bootstrap/js/scrollspy.js
Uglifying File 148 of 369 - bootstrap/js/scrollspy
Compressing File 148 of 369 - bootstrap/js/scrollspy
Processing File 149 of 369 - bootstrap/js/tab.js
Uglifying File 149 of 369 - bootstrap/js/tab
Compressing File 149 of 369 - bootstrap/js/tab
Processing File 150 of 369 - bootstrap/js/tooltip.js
Uglifying File 150 of 369 - bootstrap/js/tooltip
Compressing File 150 of 369 - bootstrap/js/tooltip
Processing File 151 of 369 - bootstrap/js/transition.js
Uglifying File 151 of 369 - bootstrap/js/transition
Compressing File 151 of 369 - bootstrap/js/transition
Processing File 152 of 369 - bootstrap/less/alerts.less
:assetCompile FAILED

FAILURE: Build failed with an exception.

What went wrong:
Execution failed for task ':assetCompile'.

java.lang.Exception: LESS Engine Compiler Failed - alerts.less:
--Could not compile less. 21 error(s) occurred:
ERROR 10:12 The variable "@alert-padding" was not declared.
9: .alert {
10: padding: @alert-padding;
11: margin-bottom: @line-height-computed;

ERROR 11:18 The variable "@line-height-computed" was not declared.
10: padding: @alert-padding;
11: margin-bottom: @line-height-computed;
12: border: 1px solid transparent;

...

Did you mean to compile this file individually (check docs on exclusion)?

Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

Why is that, and how do I fix it?

Thanks,


You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub #332