legacy-knowledge-base
公開されました Jul. 2, 2025

Gulpビルドタスクが次のように失敗します:"Error: It's not clear which file to import for '@import ..."

written-by

Alfonso Crisci

How To articles are not official guidelines or officially supported documentation. They are community-contributed content and may not always reflect the latest updates to Liferay DXP. We welcome your feedback to improve How To articles!

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

legacy-article

learn-legacy-article-disclaimer-text

問題

  • gulp build タスクを起動した後、ツールでは以下のようなエラーが発生します。
    [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

環境

  • Liferay DXP 7.0以降
  • Liferay Theme Generator

解決

追加情報

  • アンダースコア_なしで始まるSCSSファイル名は、独自にコンパイルされ、CSSに変換されます。  "@import"でインポートするファイルがあることをSASSに通知する場合、インポートされるファイル名は、認識されるためにアンダースコア_で始まる必要があります。 これは、SASSでパーシャルファイルを管理する方法と一致しています:https://sass-lang.com/guide#topic-4
did-this-article-resolve-your-issue

legacy-knowledge-base