haml

Possible to change the SASS/Compass output folder for different files?

一曲冷凌霜 提交于 2019-12-05 09:26:40
I'm wondering if it's possible for Compass to output files to different directories? I have a fairly large project and while most CSS files go in the /css folder, others need to go in the /admin/css folder. I'm symlinking them for now, but it'd be great if I could define an array of files (in config.rb?) that could be output elsewhere. In config.rb edit the css_dir = "/" to your wanted directory! I don't think it can handle multiple output folders. One way around it might be to set up symlinks from where they're supposed to go to the actual output CSS files. I might be doing the same myself

HAML: remove white space after “link_to”

泄露秘密 提交于 2019-12-05 08:49:10
问题 The following code leaves a white space in HTML: = link_to "Login", "#" Normally, HAML allows to remove it by putting ">" at the end of the line, for example: %input#query{:type => "text", :value => "Search"}> However, that seems to be impossible, when Rails code is inserted. How do I fix this? 回答1: How about this? %span>= link_to "Login", "#" It adds an extra span around the link, but those are pretty harmless. I find haml can have a bit of a problem with some of these corner cases :( 回答2:

What is a good Ruby on Rails forum that can easily integrated to an existing application?

狂风中的少年 提交于 2019-12-05 07:47:34
What is a good, open source RoR 3 forum that can easily integrated to an existing application? Optional features: OpenID support Haml/SCSS templates Support for smilies, YouTube, images, etc I'm probably going to change it alot, and I'm still pretty weak in Ruby, so clean, commented code with good practices would be great. Thanks :) The Rails community has never been focused on developing Ruby/Rails forums, conversely to other languages such as PHP. The evidence of that is a really old news talking about one of the forums prototype ever produces in Rails. You can still found traces of Beast

HAML: Indenting if/else statements with common content

二次信任 提交于 2019-12-05 07:47:21
I have the following in my view: - if (condition) %div.truecondition (Ten lines of content) - else %div.falsecondition (Ten lines of the same content) I'd like to factor out the ten lines of content to go below the if/else statement...but if I do that, indentation means the content won't be nested inside the div specified in the if/else. I'm sure this is a common problem, I'm just wondering what the solution is. So...how do I factor out that ten lines while keeping the content nested in the .truecondition/.falsecondition div? you can try Ternary operator : %div{ :class => condition ?

Markdown Line Breaks in Code Blocks

本秂侑毒 提交于 2019-12-05 06:58:13
Using Redcarpet, when I include something like the following in my markdown, it does not respect any line breaks or indention. I've tried two spaces at the end of lines. Extra lines between code. Nothing seems to work. ```xml <?xml version="1.0" encoding="UTF-8"?> <hash> <money>3</money> </hash> ``` I see: <?xml version="1.0" encoding="UTF-8"?> <hash> <money>3</money> </hash> Here are the Redcarpet settings: Redcarpet::Markdown.new(Redcarpet::Render::HTML, :autolink => true, :space_after_headers => true, :fenced_code_blocks => true, :no_intra_emphasis => true, :lax_html_blocks => true) What do

Specify options for a filter in ruby HAML

和自甴很熟 提交于 2019-12-05 05:59:33
Is there any way to add options (HTML attributes) to HAML filters? I wanted to do something like this : :javascript{:'data-turbolinks-eval' => 'false', :foo => 'bar'} if(someCondition){ doSomething(); } And the result would be : <script 'data-turbolinks-eval'='false' 'foo'='bar'> if(someCondition){ doSomething(); } </script> The closest I could get is : %script{:'data-turbolinks-eval' => 'false', :foo => 'bar'} if(someCondition){ doSomething(); } The drawback is that you can't indent your JS in HAML unless you're using the :javascript filter. It's ok for a few lines, but it can get messy

Unescaping HAML in an Attribute Hash

谁都会走 提交于 2019-12-05 05:54:12
I have a problem similar to some I've found on stackoverflow, but not quite the same. I'd like to avoid the solution to the following question: https://stackoverflow.com/a/10407782/996587 Basically, would like the following HTML output: <div class='myclass' extraattr='UNESCAPED <>& CONTENT'> Content... </div> The HAML I'm using looks like this: .myclass{ "extraattr" => "UNESCAPED <>& CONTENT" } Content... I can't quite figure out how to get the content to output the way I want. Tried applying .html_safe to the end of the string, but got the following error: undefined method `html_safe' for

Rails 2.3.2 trying to render ERB instead of HAML

血红的双手。 提交于 2019-12-05 04:27:50
问题 Rails is suddenly trying to render ERB instead of Haml and I can't figure out why. I've created new rails projects, reinstalled Haml, and reinstalled Rails. Here's exactly the steps I take when making my application (Rails 2.3.2): rails> rails test rails> cd test rails\test> haml --rails . rails\test> ruby script\generate model user email:string password:string rails\test> ruby script\generate controller users index rails\test> rake db:migrate Here's what the UsersController looks like: class

Error 'incompatible character encodings: ASCII-8BIT and UTF-8' due to 8-bit encoding of cookies (Rails 3 and Ruby 1.9)

孤街醉人 提交于 2019-12-05 03:45:46
I moved a web app that was using 1.8.7 to 1.9.2 and now I keep getting incompatible character encodings: ASCII-8BIT and UTF-8 I have the database encoding to UTF-8 and I have also 'config.encoding = "utf-8"'. I saw some ideas as possible workarounds and I added Encoding.default_external = Encoding::UTF_8 Encoding.default_internal = Encoding::UTF_8 But it didn't work either. One specific chunk of code where I am getting this error is %ul.address - @user.address.split(',').each do |line| %li= line.titleize I'm using HAML, I checked line.titleize, and the encoding is UTF-8. Seems that the

Performance implications of using :coffescript filter inside HAML templates?

半世苍凉 提交于 2019-12-05 01:38:15
So HAML 4 includes a coffeescript filter , which allows us coffee-loving rails people to do neat things like this: - word = "Awesome." :coffeescript $ -> alert "No semicolons! #{word}" My question: For the end user, is this slower than using the equivalent :javascript filter? Does using the coffeescript filter mean the coffeescript will be compiled to javascript on every page load (which would obviously be a performance disaster), or does this only happen once when the application is started? It depends. When Haml compiles a filter it checks to see if the filter text contains any interpolation