【问题标题】:Understrap - sass compile errorUnderstrap - sass 编译错误
【发布时间】:2018-03-15 11:11:43
【问题描述】:

我想编译主题 .scss 文件。所以,根据我去的文档

wp-content\themes\understrap\sass\theme

目录。我打开了_theme.scss 文件。我进行了更改,保存并...我遇到了一堆错误。我认为首先和主要的是

{ [Error: sass\theme.scss
Error: It's not clear which file to import for '@import     "theme/theme_variables"'.
       Candidates:
     theme/_theme_variables.scss
     theme/_theme_variables.css
   Please delete or rename all but one of these files.
    on line 1 of sass/theme.scss
>> @import "theme/theme_variables";  // <--------- Add your variables into     this
   ^
]
  status: 1,
  file: 'C:/xampp/htdocs/under/wp-    content/themes/understrap/sass/theme.scss',
  line: 1,
  column: 1,

我尝试安装 node-sass 3.4.1 - 没有帮助。我做错了什么?有人有类似的问题吗?

【问题讨论】:

    标签: node.js wordpress sass gulp


    【解决方案1】:

    这是因为文件具有相同的名称但不同的扩展名它无法识别女巫import

    改变

    @import "theme/theme_variables"

    @import     "theme/theme_variables.scss"
    

    或两者兼而有之 //不确定它是否会起作用

    @import     "theme/theme_variables.scss"
    @import     "theme/theme_variables.css"
    

    【讨论】:

    • { [TypeError: this is not a typed array.] message: 'this is not a typed array.', name: 'TypeError', stack: 'TypeError: this is not a typed array. \n 在 Function.from (native)\n 在 C:\\xampp\\htdocs\\under\\wp-content\\themes\\understrap\\node_modules\\gulp-autoprefixer\\index.js:26: 27\n 在 process._tickCallback (node.js:368:9)', __safety: undefined, _stack: undefined, plugin: 'gulp-autoprefixer', showProperties: true, showStack: true, fileName: 'C:\\xampp \\htdocs\\under\\wp-content\\themes\\understrap\\sass\\theme.css' }
    • 更改为theme_variables.scss后
    • 这意味着你有一些错误是你的 sass。检查你的文件和结构。
    • 我不这么认为。即使我把简单的{颜色:红色; }
    • 我想我回答了你最初的问题并解决了最初的问题。我建议您从干净的底层重新开始,构建,进行更改,再次构建。或者就新错误打开一个新问题。