I'm struggling to properly install and configure Semantic-UI using bower in my Rails 4 app. Until now, here's what I've done:
我正在努力在我的Rails 4应用程序中使用bower正确安装和配置Semantic-UI。到现在为止,这就是我所做的:
Gemfile:
gem "less-rails"
gem "therubyracer"
.bowerrc file:
{
"directory": "vendor/assets/components"
}
bower.json:
{
"name": "app",
"version": "0.0.0",
"homepage": "myapp.com",
"private": true,
"ignore": [
"**/.*",
"node_modules",
"bower_components",
"vendor/assets/components",
"test",
"tests"
],
"dependencies": {
"semantic-ui": "~1.12.2"
}
}
After bower install, semantic UI gets properly pulled into my /vendor/assets/components folder
在bower安装之后,语义UI被正确地拉入我的/ vendor / assets / components文件夹
Now, I'd like to take advantage of semantic's theming properties, without of course editing what's currently loaded by bower.
现在,我想利用语义的主题属性,而不是编辑当前由凉亭加载的内容。
I've added the following in semantic.css.less, itself being required in application.css
我在semantic.css.less中添加了以下内容,它本身在application.css中是必需的
@import "semantic-ui/src/semantic";
The issue now: semantic lib seems to be properly fetched in the proper folder, as I get the following error:
现在的问题:语义库似乎在适当的文件夹中正确获取,因为我收到以下错误:
'site//globals/site.variables' wasn't found Ok I understand that.
'site // globals / site.variables'找不到确定我明白了。
But how do I use custom configuration files with the default assets installed by bower without touching these ? How can I properly create the required configuration files (theme.config / site.variables / site.overrides), out of my /vendor/assets/components folder, and still properly assigning the SASS variables required for the lib to compile ?
但是如何使用bower安装的默认资产自定义配置文件而不触及这些?如何从我的/ vendor / assets / components文件夹中正确创建所需的配置文件(theme.config / site.variables / site.overrides),并且仍然正确地分配lib编译所需的SASS变量?
2 个解决方案
#1
I would take a gander at less-rails-semantic-ui, this is what I ended up going for my new rails project. It properly adds all the override files in vendor/assets!
我会采用较少的rails-semantic-ui,这就是我最终选择的新的rails项目。它正确添加了供应商/资产中的所有覆盖文件!
#2
If you are using less source files without npm (which includes an installer), you will need to manually create theme.config from theme.config.example and site/ from _site/ this is to avoid upstream changes affecting your local ui. https://github.com/Semantic-Org/Semantic-UI/tree/master/src#config-files
如果您在没有npm(包括安装程序)的情况下使用较少的源文件,则需要从theme.config.example和site / from _site /手动创建theme.config,以避免影响本地ui的上游更改。 https://github.com/Semantic-Org/Semantic-UI/tree/master/src#config-files
PS: from the owner answer, source: https://github.com/Semantic-Org/Semantic-UI/issues/2239
PS:来自业主的回答,来源:https://github.com/Semantic-Org/Semantic-UI/issues/2239
#1
I would take a gander at less-rails-semantic-ui, this is what I ended up going for my new rails project. It properly adds all the override files in vendor/assets!
我会采用较少的rails-semantic-ui,这就是我最终选择的新的rails项目。它正确添加了供应商/资产中的所有覆盖文件!
#2
If you are using less source files without npm (which includes an installer), you will need to manually create theme.config from theme.config.example and site/ from _site/ this is to avoid upstream changes affecting your local ui. https://github.com/Semantic-Org/Semantic-UI/tree/master/src#config-files
如果您在没有npm(包括安装程序)的情况下使用较少的源文件,则需要从theme.config.example和site / from _site /手动创建theme.config,以避免影响本地ui的上游更改。 https://github.com/Semantic-Org/Semantic-UI/tree/master/src#config-files
PS: from the owner answer, source: https://github.com/Semantic-Org/Semantic-UI/issues/2239
PS:来自业主的回答,来源:https://github.com/Semantic-Org/Semantic-UI/issues/2239