- android - 多次调用 OnPrimaryClipChangedListener
- android - 无法更新 RecyclerView 中的 TextView 字段
- android.database.CursorIndexOutOfBoundsException : Index 0 requested, 光标大小为 0
- android - 使用 AppCompat 时,我们是否需要明确指定其 UI 组件(Spinner、EditText)颜色
我最近开始在 Rails 3.1 中使用 ExtJS 4。我一直在使用 ExtJS 4 捆绑的预构建主题 (ext-all.css),但我一直在争论是否要引入 sass Angular 。总的来说,我对 sass 很陌生,但我真的很喜欢它背后的想法,如果能够只编辑几个变量来重新设置整个网站的主题,那就太好了。
我想知道是否有人做过,将它合并到样式表 Assets 管道中有多难?特别是因为它似乎需要一些返工,因为使用指南针作为基础。
最佳答案
我有一个运行 Ext JS 4 前端的 Rails 3(不是 3.1)应用程序,它直接从默认主题 SASS 生成样式表。我正在使用 Jammit对于 Assets 管道,但与 Sprockets 几乎没有区别, 因为这两种情况下的工作都是由 Compass 完成的.
首先将 Compass 放入您的 Gemfile
中,确保您安装了 Compass :
gem 'compass'
Compass 已宣布 sass
gem 作为依赖,所以不需要声明它。现在您需要捆绑 Gem 并初始化 Compass:
$ bundle
$ compass init rails
然后我创建了一个文件夹public/resources/scss
,我把所有 SCSS 文件放在那里。在这个文件夹中,我有我的主要应用程序 SCSS 文件 application.scss
,包括所有必要的 Compass 模块和更多部分:
$theme-name: 'default';
@import 'compass/css3';
@import 'partials/ext4';
@import 'partials/sprites';
@import 'partials/fonts';
接下来我将所有 Ext 4 SASS 主题文件复制到 public/resources/scss/ext4/default
并创建了另一个文件夹 public/resources/scss/partials
我将所有自定义 SCSS 部分和 Ext 4 初始化文件放在哪里 _ext4.scss
:
$include-default: true;
@import 'ext4/default/all';
这是设置 Ext 4 使用的一些 Compass 变量的正确位置。这里是一些主题样式的示例,直接从 Ext 4 SASS 文件复制:
/**
* @var {string} $font-family
* The default font-family to be used throughout the theme.
*
* @var {string} $base-gradient
* The base gradient to be used throughout the theme.
*
* @var {color} $base-color
* The base color to be used throughout the theme.
*
* @var {color} $css-shadow-background-color
* The base color for CSS shadows
*/
现在你基本上已经准备好了一切:
但是还缺少最后一点:Ext 4 有一些需要到位的自定义 Compass 函数。此文件放在 Ext JS 4 框架中 resources/themes/lib/utils.rb
下.因为原始文件不能按照我组织文件的方式开箱即用,所以我根据需要简单地修改了它并将其直接放在 Compass 初始化文件中 config/compass.rb
:
project_type = :rails
project_path = Compass::AppIntegration::Rails.root
environment = Compass::AppIntegration::Rails.env
http_path = "/"
http_images_path = "/resources/images"
sass_dir = "public/resources/scss"
css_dir = "public/resources/css"
images_dir = "public/resources/images"
# File copied from ext-4.0.2a/resources/themes/lib/utils.rb
#
module ExtJS4
module SassExtensions
module Functions
module Utils
def parsebox(list, n)
assert_type n, :Number
if !n.int?
raise ArgumentError.new("List index #{n} must be an integer")
elsif n.to_i < 1
raise ArgumentError.new("List index #{n} must be greater than or equal to 1")
elsif n.to_i > 4
raise ArgumentError.new("A box string can't contain more then 4")
end
new_list = list.clone.to_a
size = new_list.size
if n.to_i >= size
if size == 1
new_list[1] = new_list[0]
new_list[2] = new_list[0]
new_list[3] = new_list[0]
elsif size == 2
new_list[2] = new_list[0]
new_list[3] = new_list[1]
elsif size == 3
new_list[3] = new_list[1]
end
end
new_list.to_a[n.to_i - 1]
end
def parseint(value)
Sass::Script::Number.new(value.to_i)
end
# Returns a background-image property for a specified images for the theme
def theme_image(theme, path, without_url = false, relative = false)
without_url = (without_url.class == FalseClass) ? without_url : without_url.value
if !without_url
url = "url('/resources/images/ext4/#{ theme.value }/#{ path.value }')"
else
url = "/resources/images/ext4/#{ theme.value }/#{ path.value }"
end
Sass::Script::String.new(url)
end
def theme_image_exists(path)
result = false
where_to_look = File.join(Rails.root, 'public') + path.value.gsub('../../resources', 'resources')
if where_to_look && FileTest.exists?("#{where_to_look}")
result = true
end
Sass::Script::Bool.new(result)
end
end
end
end
end
module Sass::Script::Functions
include ExtJS4::SassExtensions::Functions::Utils
end
现在您可以在您的部分中设置 Ext 4 变量,您的自定义设置的所有 CSS 都是动态生成的,而且只有所有不错的 Compass 功能,如 Sprites .
关于css - 在 Rails 3.1 Assets 管道中使用来自 ExtJS4 的 sass,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6495216/
我正在使用 Assets 管道来管理我的 Grails 3.0 应用程序的前端资源。但是,似乎没有创建 CoffeeScript 文件的源映射。有什么办法可以启用它吗? 我的 build.gradle
我有一个我想要的管道: 提供一些资源, 运行一些测试, 拆资源。 我希望第 3 步中的拆卸任务运行 不管 测试是否通过或失败,在第 2 步。据我所知 runAfter如果前一个任务成功,则只运行一个任
如果我运行以下命令: Measure-Command -Expression {gci -Path C:\ -Recurse -ea SilentlyContinue | where Extensio
我知道管道是一个特殊字符,我需要使用: Scanner input = new Scanner(System.in); String line = input.next
我再次遇到同样的问题,我有我的默认处理方式,但它一直困扰着我。 有没有更好的办法? 所以基本上我有一个运行的管道,在管道内做一些事情,并想从管道内返回一个键/值对。 我希望整个管道返回一个类型为 ps
我有三个环境:dev、hml 和 qa。 在我的管道中,根据分支,阶段有一个条件来检查它是否会运行: - stage: Project_Deploy_DEV condition: eq(varia
我有 Jenkins Jenkins ver. 2.82 正在运行并想在创建新作业时使用 Pipeline 功能。但我没有看到这个列为选项。我只能在自由式项目、maven 项目、外部项目和多配置之间进
在对上一个问题 (haskell-data-hashset-from-unordered-container-performance-for-large-sets) 进行一些观察时,我偶然发现了一个奇
我正在寻找有关如何使用管道将标准输出作为其他命令的参数传递的见解。 例如,考虑这种情况: ls | grep Hello grep 的结构遵循以下模式:grep SearchTerm PathOfFi
有没有办法不因声明性管道步骤而失败,而是显示警告?目前我正在通过添加 || exit 0 来规避它到 sh 命令行的末尾,所以它总是可以正常退出。 当前示例: sh 'vendor/bin/phpcs
我们正在从旧的 Jenkins 设置迁移到所有计划都是声明性 jenkinsfile 管道的新服务器……但是,通过使用管道,我们无法再手动清除工作区。我如何设置 Jenkins 以允许 手动点播清理工
我在 Python 中阅读了有关 Pipelines 和 GridSearchCV 的以下示例: http://www.davidsbatista.net/blog/2017/04/01/docume
我有一个这样的管道脚本: node('linux'){ stage('Setup'){ echo "Build Stage" } stage('Build'){ echo
我正在使用 bitbucket 管道进行培训 这是我的 bitbucket-pipelines.yml: image: php:7.2.9 pipelines: default:
我正在编写一个程序,其中输入文件被拆分为多个文件(Shamir 的 secret 共享方案)。 这是我想象的管道: 来源:使用 Conduit.Binary.sourceFile 从输入中读取 导管:
我创建了一个管道,它有一个应该只在开发分支上执行的阶段。该阶段还需要用户输入。即使我在不同的分支上,为什么它会卡在这些步骤的用户输入上?当我提供输入时,它们会被正确跳过。 stage('Deplo
我正在尝试学习管道功能(%>%)。 当试图从这行代码转换到另一行时,它不起作用。 ---- R代码--原版----- set.seed(1014) replicate(6,sample(1:8))
在 Jenkins Pipeline 中,如何将工件从以前的构建复制到当前构建? 即使之前的构建失败,我也想这样做。 最佳答案 Stuart Rowe 还在 Pipeline Authoring Si
我正在尝试使用 执行已定义的作业构建 使用 Jenkins 管道的方法。 这是一个简单的例子: build('jenkins-test-project-build', param1 : 'some-
当我使用 where 过滤器通过管道命令排除对象时,它没有给我正确的输出。 PS C:\Users\Administrator> $proall = Get-ADComputer -filter *
我是一名优秀的程序员,十分优秀!