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

scss中:export后,RN端运行出错 #1848

Closed
tourze opened this issue Jan 7, 2019 · 9 comments
Closed

scss中:export后,RN端运行出错 #1848

tourze opened this issue Jan 7, 2019 · 9 comments
Assignees

Comments

@tourze
Copy link
Contributor

tourze commented Jan 7, 2019

为了方便在scss和js中共享变量,我在scss中使用:export来导出一些变量给JS使用。

然后在RN端运行遇到一些问题,一进入模拟器就会报错:

image

image

image

系统信息

Taro CLI 1.2.4 environment info:
System:
OS: macOS 10.14.2
Shell: 5.3 - /bin/zsh
Binaries:
Node: 10.11.0 - /usr/local/bin/node
Yarn: 1.3.2 - /usr/local/bin/yarn
npm: 6.4.1 - /usr/local/bin/npm
npmGlobalPackages:
typescript: 2.4.2
补充信息

看页面提示,是因为StyleSheet中创建的样式,不是对象格式

@taro-bot
Copy link

taro-bot bot commented Jan 7, 2019

欢迎提交 Issue~

如果你提交的是 bug 报告,请务必遵循 Issue 模板的规范,尽量用简洁的语言描述你的问题,最好能提供一个稳定简单的复现。🙏🙏🙏

如果你的信息提供过于模糊或不足,或者已经其他 issue 已经存在相关内容,你的 issue 有可能会被关闭。

Good luck and happy coding~

@taro-bot
Copy link

taro-bot bot commented Jan 8, 2019

CC @Pines-Cheng

@Pines-Cheng
Copy link
Contributor

sass 有 :export 用法吗?我在官方文档里面没有找到啊。

@tourze
Copy link
Contributor Author

tourze commented Jan 8, 2019

export

参考 https://til.hashrocket.com/posts/sxbrscjuqu-share-scss-variables-with-javascript
其实我也没看过文档。。。是在一些开源项目中看到有类似用法

@Pines-Cheng
Copy link
Contributor

这种实现是借助了 Webpack 和 CSS modules 的能力。

@tourze
Copy link
Contributor Author

tourze commented Jan 8, 2019

这种实现是借助了 Webpack 和 CSS modules 的能力。

是的。。。现在怎么解决这个呢?

@Pines-Cheng
Copy link
Contributor

RN 端搞不了~😢

@tourze
Copy link
Contributor Author

tourze commented May 22, 2019

在实际进行RN开发中,scss变量作为theme参数,在js中共享这种场景很难避免啊。。。能否修复下这个问题? https://til.hashrocket.com/posts/sxbrscjuqu-share-scss-variables-with-javascript

@tourze
Copy link
Contributor Author

tourze commented May 22, 2019

现在官方已经fork了css-react-native,应该是能解决这种问题了?

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

2 participants