Legacy Knowledge Base
Published Jul. 2, 2025

Gulp build task fails with: "Error: It's not clear which file to import for '@import ..."

Written By

Alfonso Crisci

How To articles are not official guidelines or officially supporteddocumentation. They are community-contributed content and may not alwaysreflect the latest updates to Liferay DXP. We welcome your feedback toimprove How to articles!

While we make every effort to ensure this Knowledge Base is accurate, itmay not always reflect the most recent updates or official guidelines.We appreciate your understanding and encourage you to reach out with anyfeedback or concerns.

Legacy Article

You are viewing an article from our legacy "FastTrack"publication program, made available for informational purposes. Articlesin this program were published without a requirement for independentediting or verification and are provided "as is" withoutguarantee.

Before using any information from this article, independently verify itssuitability for your situation and project.

Issue

  • After launching a gulp build task, the tool will encounter an error similar to the below:
    [15:14:33] 'build:compile-lib-sass' errored after 811 ms
    [15:14:33] Error in plugin 'gulp-sass'
    Message:
      build/_css/mystyle.scss
    Error: It's not clear which file to import for '@import "my-variables"'.
          Candidates:
          my-variables.scss
          my-variables.css
          Please delete or rename all but one of these files.
          on line 1 of build/_css/mystyle.scss
    >> @import 'my-variables';
      ^

        domainEmitter: [object Object]
        domainThrown: false
    [15:14:33] 'build:compile-css' errored after 812 ms
    [15:14:33] 'build' errored after 1.57 s

Environment

  • Liferay DXP 7.0+
  • Liferay Theme Generator

Resolution

Additional Information

  • SCSS file names starting without underscore _ are going to be compiled on their own and will be converted to CSS. If we want to let SASS know that there is a file to be imported  with "@import",  the imported file name should start with underscore _ in order to be recognized. This is in line with the way of managing the partials file with SASS: https://sass-lang.com/guide#topic-4
Did this article resolve your issue ?

Legacy Knowledge Base