如何关闭自动样式表/ JavaScript生成Rails 3.1? [英] How do I turn off automatic stylesheet/javascript generation on Rails 3.1?

查看:148
本文介绍了如何关闭自动样式表/ JavaScript生成Rails 3.1?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个Rails 3.1项目,我正在工作,但我不想 controller_name.css.sass controller_name每次运行 rails generate controller controller_name 时生成.js.coffee 。我可以发誓我已经在互联网上的某个地方看到这个设置,但是我现在找不到它的生活。是什么?



请记住,我仍然想要使用资产管道和CoffeeScript / Sass集成,但是我正在组织这些文件方法。



我很确定答案是一个命令行参数,但是通过生成器设置或隐藏文件或其他东西来关闭它。 p>

EDIT :我找到了命令行标志。

  rails generate controller controller_name --assets = false 

(该行实际上是错误输出,但它也不生成资产)。 API 此处显示:assets => true 作为默认选项。

解决方案

将这些行添加到 application.rb

  config.generators.stylesheets = false 
config.generators.javascripts = false


I've got a Rails 3.1 project that I'm working on, but I don't want controller_name.css.sass and controller_name.js.coffee to be generated each time I run rails generate controller controller_name. I could swear I've seen the setting somewhere on the internet, but I can't find it now for the life of me. What is it?

Keep in mind that I'm still wanting to use the Asset Pipeline and the CoffeeScript/Sass integration, but I'm organizing those files in my own way.

I'm pretty sure the answer is a command line argument, but bonus points for turning it off with a generator setting or a hidden file or something.

EDIT: I've found the command line flag for it.

rails generate controller controller_name --assets=false

Or something of the like (that line actually errors out, but it also doesn't generate the assets). The API here shows :assets => true as a default option. How do I change that to false and have it always be false every time I generate a controller?

解决方案

Add these lines to application.rb:

config.generators.stylesheets = false
config.generators.javascripts = false

这篇关于如何关闭自动样式表/ JavaScript生成Rails 3.1?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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