【问题标题】:Proper Semantic-UI / Bower / Rails 4 configuration正确的 Semantic-UI / Bower / Rails 4 配置
【发布时间】:2015-05-11 18:22:19
【问题描述】:

我正在努力在我的 Rails 4 应用程序中使用 bower 正确安装和配置 Semantic-UI。 到目前为止,这是我所做的:

宝石文件:

gem "less-rails"
gem "therubyracer"

.bowerrc 文件:

{
  "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"
 }
}

安装 bower 后,语义 UI 被正确拉入我的 /vendor/assets/components 文件夹

现在,我想利用语义的主题属性,当然无需编辑 bower 当前加载的内容。

我在semantic.css.less 中添加了以下内容,它本身在application.css 中是必需的

@import "semantic-ui/src/semantic";

现在的问题:语义库似乎已正确提取到正确的文件夹中,因为我收到以下错误:

'site//globals/site.variables' 未找到 好的,我明白了。

但是我如何使用自定义配置文件和 bower 安装的默认资产而不触及这些? 如何从我的 /vendor/assets/components 文件夹中正确创建所需的配置文件(theme.config / site.variables / site.overrides),并且仍然正确分配 lib 编译所需的 SASS 变量?

【问题讨论】:

    标签: ruby-on-rails ruby ruby-on-rails-4 bower semantic-ui


    【解决方案1】:

    我想看看less-rails-semantic-ui,这就是我最终为我的新 Rails 项目所做的事情。它正确地添加了供应商/资产中的所有覆盖文件!

    【讨论】:

    • 喜欢在应用程序周围不进行丑陋调整的想法。打算试一试这颗宝石。谢谢。
    【解决方案2】:

    如果您在没有 npm(包括安装程序)的情况下使用较少的源文件,则需要从 theme.config.example 手动创建 theme.config 并从 _site/ 创建 site/ 这是为了避免上游更改影响您的本地 ui . https://github.com/Semantic-Org/Semantic-UI/tree/master/src#config-files

    PS:来自业主的回答,来源: https://github.com/Semantic-Org/Semantic-UI/issues/2239

    【讨论】:

      猜你喜欢
      • 2017-11-05
      • 2014-11-10
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-10-20
      • 2014-10-02
      • 2022-11-09
      相关资源
      最近更新 更多