ActiveAdmin资产预编译错误 [英] ActiveAdmin assets precompile error

查看:47
本文介绍了ActiveAdmin资产预编译错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

ActiveAdmin给了我

ActiveAdmin is giving me an

Undefined mixin 'global-reset'.

尝试运行时出现错误

rake assets:precompile

ActiveAdmin为0.3.4。
我的Gemfile中有ActiveAdmin和一个资产组,该资产组中包含Sass,coffee-rails和uglifier。

ActiveAdmin is 0.3.4. I have ActiveAdmin and an assets group in my Gemfile with sass, coffee-rails and uglifier.

推荐答案

问题正如@dimitar所指出的,确实存在所有问题,这是因为资产管道正在尝试编译部分,并且由于它们不是编写为自己编译的,因此会出现依赖性问题。

The problem is indeed, as @dimitar points out, the line with the catch all because the asset pipeline is trying to compile partials and since they aren't written to be compiled on their own, dependency issues appear.

根据您的应用程序,您可能需要全部捕获,特别是如果您在多个子文件夹中有许多JS,CoffeScript和SCSS / SASS文件。在这种情况下,您可能会遇到Rails抱怨的问题,因为移除全部捕获后,某些东西没有被编译用于生产。

Depending on your app, you might need that catch all, specially if you have many JS, CoffeScript and SCSS/SASS files in several child folders. In that situation you might encounter that rails complains because something isn't compiled for production when the catch all is removed.

解决方案是捕获所有不包括SASS部分的_filename.css。[scss | sass]并可以解决它(对我有用!)。我还包括了其他activeadmin建议中的其他一些技巧,包括一些要编译的ActiveAdmin依赖项。这是我的代码:

The solution is to have a catch all that excludes the SASS partials, _filename.css.[scss|sass] and that would solve it (worked for me!). I also included some other tips from other activeadmin suggestions including exactly some ActiveAdmin dependencies to be compiled. Here's my code:

 # Include all JS files, also those in subdolfer or javascripts assets folder
 # includes for exmaple applicant.js. JS isn't the problem so the catch all works.
 config.assets.precompile += %w(*.js)
 # Replace %w( *.css *.js *.css.scss) with complex regexp avoiding SCSS partials compilation
 config.assets.precompile += [/^[^_]\w+\.(css|css.scss)$/]
 #Adding active_admin JS and CSS to the precompilation list
 config.assets.precompile += %w( active_admin.css active_admin.js active_admin/print.css )

这篇关于ActiveAdmin资产预编译错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆