Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow Pretty format for develpment mode and deeper Slim configuration #30

Closed
hilios opened this issue May 8, 2013 · 7 comments
Closed

Comments

@hilios
Copy link

hilios commented May 8, 2013

It would be nice to have this configurations bundled into the gem, won't you think?

Slim::Engine.set_default_options pretty: Rails.env.development?, sort_attrs: Rails.env.development?

And also have the config option inside rails application itself, so we could allow users to setup Slim completely without monkey-patching.

module Radness
  class Application < Rails::Application
    # ...
    config.slim_template.pretty = true
    config.slim_template.sort_attrs = true
    # or block style
    config.slim_template do
      pretty = true
      sort_attrs = true
    end
  end
end

What you think about it?

@minad
Copy link
Member

minad commented May 21, 2013

The pretty proposal is reasonable. The second proposal however is not an option since Slim/Temple brings its own configuration framework independant of rails.

@korzhyk
Copy link

korzhyk commented Jun 15, 2013

I think it's a good idea, because we have a "slim-rails", and support rails configuration will be good for rails applications.

@johnnyshields
Copy link

+1 👍

@Fedcomp
Copy link

Fedcomp commented Jul 31, 2019

I just ran into this. It would be nice to have application.rb/environments config so it would feel well integrated into rails.

The second proposal however is not an option since Slim/Temple brings its own configuration framework independant of rails.

It doesn't have to inherit rails configuration, it may have simple class which will proxy all configuration calls to slim engine.

In pseudocode:

class SlimRailsConfigProxy
  def method_missing(method, args)
    if Slim::Engine.options.respond_to?(method)
      Slim::Engine.options.send(method, args)
    else
      raise ArgumentError, "Slim does not have option #{method}"
    end
  end
end

@minad may you reconsider your decision? would you accept PR of such functionality?

@januszm
Copy link
Contributor

januszm commented Jul 31, 2019

@Fedcomp sounds good. I'm the current maintainer of this gem, let's work on a new PR for this functionality.

@Fedcomp
Copy link

Fedcomp commented Jul 31, 2019

Okay thanks! i'll try to make a PR this or next weekend.

@Fedcomp
Copy link

Fedcomp commented May 16, 2020

@januszm sorry. Unfornately when i found time to work on it, i ran into incompatibility with rails 3, and left no time and willing to resolve it. And i'll probably stop.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants