Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[bug]也许我找到了丢失新变量的原因/Maybe I found the reason why lost the new theme variable #84

Open
sqchenxiyuan opened this issue Dec 23, 2019 · 0 comments

Comments

@sqchenxiyuan
Copy link
Contributor

最近更新版本,编译样式时提示缺少变量,但是我的变量文件是重新--init出来的,发现确实没有改动,然后查看样式库的变量发现确实有新变量加入,然后看了下编译代码,发现这里有问题

Recently, I was updating the version of the style library. When compiling the style, I noticed that there was a lack of variables. But my variable file was "init" again. I found that it did not change. Then I checked the variables in the style library and found that there were new variables added. Then I looked at the compiled code and found that there was a problem

var varsPath = path.resolve(config.themePath, './src/common/var.scss')
fs.writeFileSync(varsPath, fs.readFileSync(path.resolve(process.cwd(), opts.config || config.config)), 'utf-8')

这里通过将配置文件覆盖到库中的方式进行编译,这就会存在一个问题:当我更新样式库后,第一反应是进行编译,如果编译不通过才是重新生成样式。在更新样式库后,发现构建失败时,样式库内的变量文件已经被替换了,这时再重新init就获取不了真实的样式。所以需要在构建完成后恢复变量文件,或者将变量文件缓存到其他地方(这个也许比较好,毕竟恢复会存在中断的问题)

There is a problem in compiling by overwriting the configuration file to the Library: when I update the style library, the first response is to compile. If the compilation fails, the style will be regenerated. After updating the style library, it is found that when the construction fails, the variable files in the style library have been replaced. At this time, init again will not get the real style. So need to recover the variable file after the construction is completed, or cache the variable file to other places (this may be better, after all, the recovery will be interrupted)

sqchenxiyuan@40298ce

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant