slim-template / slim-rails Goto Github PK
View Code? Open in Web Editor NEWSlim templates generator for Rails
License: MIT License
Slim templates generator for Rails
License: MIT License
create app/controllers/admin_controller.rb
invoke slim
create app/views/admin
invoke rspec
create spec/controllers/admin_controller_spec.rb
invoke helper
create app/helpers/admin_helper.rb
invoke rspec
create spec/helpers/admin_helper_spec.rb
invoke assets
invoke coffee
create app/assets/javascripts/admin.js.coffee
invoke sass
create app/assets/stylesheets/admin.css.sass
only app/views/admin
version:
ruby 2.0.0p353 (2013-11-22 revision 43784) [x86_64-darwin13.0.2]
Rails 4.0.2
gem 'slim-rails', '~> 2.1.0'
Gem does not create views/layouts/application.html.slim file after invoking controller generator first time in fresh created rails app.
Command output:
$rails g controller Site --no-test-framework
create app/controllers/site_controller.rb
invoke slim
create app/views/site
invoke helper
create app/helpers/site_helper.rb
invoke assets
invoke coffee
create app/assets/javascripts/site.js.coffee
invoke scss
create app/assets/stylesheets/site.css.scss
I get the following error after including slim-rails in my Gemfile and then trying to generate a scaffold, I'm using Ruby 1.9.2p136 (Under RVM), Bundler 1.0.10, Rails 3.0.3, Slim 0.9.0 and Slim-Rails 0.1.2:
~/.rvm/gems/ruby-1.9.2-p136/gems/slim-rails-0.1.2/lib/slim-rails.rb:2:in `require': no such file to load -- slim/rails (LoadError)
from ~/.rvm/gems/ruby-1.9.2-p136/gems/slim-rails-0.1.2/lib/slim-rails.rb:2:in `<top (required)>'
from ~/.rvm/gems/ruby-1.9.2-p136/gems/bundler-1.0.10/lib/bundler/runtime.rb:68:in `require'
from ~/.rvm/gems/ruby-1.9.2-p136/gems/bundler-1.0.10/lib/bundler/runtime.rb:68:in `block (2 levels) in require'
from ~/.rvm/gems/ruby-1.9.2-p136/gems/bundler-1.0.10/lib/bundler/runtime.rb:66:in `each'
from ~/.rvm/gems/ruby-1.9.2-p136/gems/bundler-1.0.10/lib/bundler/runtime.rb:66:in `block in require'
from ~.rvm/gems/ruby-1.9.2-p136/gems/bundler-1.0.10/lib/bundler/runtime.rb:55:in `each'
from ~/.rvm/gems/ruby-1.9.2-p136/gems/bundler-1.0.10/lib/bundler/runtime.rb:55:in `require'
from ~/.rvm/gems/ruby-1.9.2-p136/gems/bundler-1.0.10/lib/bundler.rb:120:in `require'
from ~/code/ruby/test_slim_rails/config/application.rb:7:in `<top (required)>'
from ~/.rvm/gems/ruby-1.9.2-p136/gems/railties-3.0.3/lib/rails/commands.rb:15:in `require'
from ~/.rvm/gems/ruby-1.9.2-p136/gems/railties-3.0.3/lib/rails/commands.rb:15:in `<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>'
2.0.0.pre.6 has an issue with the combination of pretty, html_safe, and dynamic due to a bug in temple
I've submitted a pull request
judofyr/temple#69
When I run $ rails generate mailer UserMailer account_activation password_reset
on a rails app with no slim-rails:
create app/mailers/user_mailer.rb
create app/mailers/application_mailer.rb
invoke erb
create app/views/user_mailer
create app/views/layouts/mailer.text.erb
create app/views/layouts/mailer.html.erb
create app/views/user_mailer/account_activation.text.erb
create app/views/user_mailer/account_activation.html.erb
create app/views/user_mailer/password_reset.text.erb
create app/views/user_mailer/password_reset.html.erb
invoke test_unit
create test/mailers/user_mailer_test.rb
create test/mailers/previews/user_mailer_preview.rb
with slim-rails:
create app/mailers/user_mailer.rb
create app/mailers/application_mailer.rb
invoke slim
create app/views/user_mailer
create app/views/user_mailer/account_activation.text.slim
create app/views/user_mailer/password_reset.text.slim
invoke test_unit
create test/mailers/user_mailer_test.rb
create test/mailers/previews/user_mailer_preview.rb
Missing are:
create app/views/layouts/mailer.text.slim
create app/views/layouts/mailer.html.slim
create app/views/user_mailer/account_activation.html.slim
create app/views/user_mailer/password_reset.html.slim
Any specific reason why, or a setting that I may have overlooked?
The only setting I have is:
Slim::Engine.set_options pretty: true, sort_attrs: false
in environments/development.rb
Rails 4.1 doesn't seem to be supported.
http://rubygems.org/gems/slim-rails links to https://github.com/leogalmeida/slim-rails instead of here.
@leogalmeida Do you have time for this?
Is there a way to configure Slim-Rails generators to output with tabs rather than (2) spaces?
Changes made in commit d641fda break rails 3.2 and ruby 1.9.3.
This is the change that breaks it.
source_root File.expand_path '..', 'templates', __FILE__
File.expand_path only takes two arguments.
@leogalmeida A new version with slim 2.0 support would be nice.
A very minor thing, the current gemspec is invalid:
slim-rails at /Users/Fred/.rvm/gems/ruby-1.9.2-p0/bundler/gems/slim-rails-1342c989bbd3 did not have a valid gemspec.
This prevents bundler from installing bins or native extensions, but that may not affect its functionality.
The validation message from Rubygems was:
["README.rdoc"] are not files
I am trying to use slim/smart and it is not working. Is it part of this release? https://github.com/slim-template/slim/blob/master/doc/smart.md
Hello!
I've got interesting bug
search/index.html.slim
.users.row
- @users.reverse_each do |printer|
= render 'search/user', user: user
= unless user == @users.first
hr
.clearfix
and at point
= unless user == @users.first
hr
(It's equal sign before unless)
It renders all template search/index.html.slim
@users are selected with Sunspot(solr)
Maybe it's a bug of Rails render, if it's needed I'll move it there
Current gemspec:
gem.add_development_dependency 'actionmailer', ['>= 3.1', '< 5.0']
gem.add_runtime_dependency 'actionpack', ['>= 3.1', '< 5.0']
gem.add_runtime_dependency 'railties', ['>= 3.1', '< 5.0']
Hi, 3dd168b is still unreleased but already several months in master. Could you on occasion push a new release to Rubygems?
Hi all
i get this wih an ugly passenger error
Error message:
Could not find temple-0.3.4 in any of the sources (Bundler::GemNotFound)
Exception class:
PhusionPassenger::UnknownError
I cleaned up my gemset and reinstalled all the gems but still have this issue.
Any possible fix?
Thx for your help
I have an application that has slim templates. Now we are planning to migrate this to backbone. I tried to use slim in JS templates like file_name.jst.eco.slim. it works for the html part but ruby code does not work in it. One can do such things in HAML using haml_assets gem but I don't find anything like this in slim.
The slim_assets gem does not work.
Please advise.
So PR should be automatically tested on Travis
Quoting from: http://docs.travis-ci.com/user/getting-started/
Step two: Activate GitHub Webhook #
Once you're signed in, and we've initially synchronized your repositories from GitHub, go to your profile page for open source or for your private projects.
You'll see all the organizations you're a member of and all the repositories you have access to. The ones you have administrative access to are the ones you can enable the service hook for.
Flip switch to on for all repositories you'd like to enable.
Hi,
at some point the defaults changed and now in development slim puts whitespaces between tags but in production it doesn't.
That is a problem since tags that are styled as inline elements will behave differently based on those settings.
More about this issue here: slim-template/slim#594 (comment)
IMO development / staging and production should always behave in the same way.
Please consider changing the defaults back so no unexpected behavior occurs on different environments.
Thanks
Tobias
Even after patching #17 I get this error in rails 3.2.1
[WARNING] Could not load generator "generators/slim/scaffold/scaffold_generator". Error: undefined local variable or method `templates' for Slim::Generators::ScaffoldGenerator:Class.
Buttloads of parens
# lib/generators/slim/scaffold/scaffold_generator.rb
require 'rails/generators/erb/scaffold/scaffold_generator'
module Slim
module Generators
class ScaffoldGenerator < Erb::Generators::ScaffoldGenerator
source_root File.expand_path(File.join('..', templates), __FILE__)
def copy_view_files
available_views.each do |view|
filename = filename_with_extensions view
template "#{view}.html.slim",
File.join('app', 'views', controller_file_path, filename)
end
end
hook_for :form_builder, :as => :scaffold
protected
def available_views
['index', 'edit', 'show', 'new', '_form']
end
def handler
:slim
end
end
end
end
This is happening with vanilla rails and also with inherited_resources
Hello, slim-rails seems not compatible with rails 4.2.x...
$ bundle update rails
Bundler could not find compatible versions for gem "actionpack":
In Gemfile:
slim-rails (>= 0) ruby depends on
actionpack (< 4.2, >= 3.0) ruby
rails (= 4.2) ruby depends on
actionpack (4.2.0)
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?
The generated templates contain a crazy ERB/Slim mixture. Can you please fix this?
Hi @leogalmeida ,
do you want to transfer this repo to the slim-template organization? I will give you access there if you want.
Daniel (@minad, for the Slim team)
From
Provides rails 3 generators for slim
to
Provides rails 3 + 4 generators for slim
(or something similar).
This is the original issue:
slim-template/slim#558
Basically I want Slim include partials to update because it would ease development. I think they look soo much nicer than rails partials to use. I know that this cannot be used everywhere like when u need dynamic partial names.
I use slim-rails 2.1.5,but i have one question.My form_tag doesn't work.But form submit and reload page .The url show authenticity_token and params .Can you help me?
my example:
= form_tag export_probability_settings_path, multipart:true do
environment ruby 2.1 rails 4.1.5
Look my Gemfile: http://gist.github.com/654222
And execute bundle install, but return a error: http://gist.github.com/654227
Any suggestion?
It doesn't seem that assets under app/assets/javascripts/
are compiled by slim.
There's a gem angular-rails-templates that takes files like app/assets/javascript/templates/settings.html
and converts them to JS files that insert HTML template into angular's template cache. My understanding is that we should be able to name files template.html.slim
, which would be processed by SLIM first to generate HTML, then by angular-rails-templates
to generate JS. This doesn't seem to work and the behaviour is very odd. Please see pitr/angular-rails-templates#18 for more info
I have an odd issue, on my page, I render (via slim) a div element that looks something like this:
#sessionReminder.modal.hide.fade
However the output looks like this:
<div id="sessionReminder" class="modal"></div>
This was working in Rails 3.2 (and earlier) however in Rails 4 it seems to drop the .hide and .fade classes.
If I re-arrange the classes, whatever is the first class (ie .hide.fade.modal) only shows up (in this case hide).
Thanks in advance
Rails 3.2.1
ruby 1.9.3p0 (2011-10-30 revision 33570) [x86_64-linux]
Using slim (1.1.0)
Using slim-rails (1.0.2)
[hs@hs anode]$ rails g scaffold post title:string content:string
invoke mongoid
identical app/models/post.rb
invoke test_unit
identical test/unit/post_test.rb
identical test/fixtures/posts.yml
route resources :posts
invoke scaffold_controller
identical app/controllers/posts_controller.rb
[WARNING] Could not load generator "generators/slim/scaffold/scaffold_generator". Error: /home/hs/.rvm/gems/ruby-1.9.3-p0/bundler/gems/slim-rails-8c6ad105aa7a/lib/generators/slim/scaffold/scaffold_generator.rb:11: syntax error, unexpected tSTRING_BEG, expecting keyword_end
...#{view}.html.slim", File.join 'app', 'views', controller_fil...
... ^
/home/hs/.rvm/gems/ruby-1.9.3-p0/bundler/gems/slim-rails-8c6ad105aa7a/lib/generators/slim/scaffold/scaffold_generator.rb:11: syntax error, unexpected ',', expecting keyword_end
...w}.html.slim", File.join 'app', 'views', controller_file_pat...
... ^
/home/hs/.rvm/gems/ruby-1.9.3-p0/bundler/gems/slim-rails-8c6ad105aa7a/lib/generators/slim/scaffold/scaffold_generator.rb:11: syntax error, unexpected ',', expecting keyword_end
...lim", File.join 'app', 'views', controller_file_path, filena...
... ^
/home/hs/.rvm/gems/ruby-1.9.3-p0/bundler/gems/slim-rails-8c6ad105aa7a/lib/generators/slim/scaffold/scaffold_generator.rb:11: syntax error, unexpected '\n', expecting '='
/home/hs/.rvm/gems/ruby-1.9.3-p0/bundler/gems/slim-rails-8c6ad105aa7a/lib/generators/slim/scaffold/scaffold_generator.rb:27: syntax error, unexpected $end, expecting keyword_end.
/home/hs/.rvm/gems/ruby-1.9.3-p0/gems/activesupport-3.2.1/lib/active_support/dependencies.rb:251:in `require'
/home/hs/.rvm/gems/ruby-1.9.3-p0/gems/activesupport-3.2.1/lib/active_support/dependencies.rb:251:in `block in require'
/home/hs/.rvm/gems/ruby-1.9.3-p0/gems/activesupport-3.2.1/lib/active_support/dependencies.rb:236:in `load_dependency'
/home/hs/.rvm/gems/ruby-1.9.3-p0/gems/activesupport-3.2.1/lib/active_support/dependencies.rb:251:in `require'
/home/hs/.rvm/gems/ruby-1.9.3-p0/gems/railties-3.2.1/lib/rails/generators.rb:298:in `block (2 levels) in lookup'
/home/hs/.rvm/gems/ruby-1.9.3-p0/gems/railties-3.2.1/lib/rails/generators.rb:294:in `each'
/home/hs/.rvm/gems/ruby-1.9.3-p0/gems/railties-3.2.1/lib/rails/generators.rb:294:in `block in lookup'
/home/hs/.rvm/gems/ruby-1.9.3-p0/gems/railties-3.2.1/lib/rails/generators.rb:293:in `each'
/home/hs/.rvm/gems/ruby-1.9.3-p0/gems/railties-3.2.1/lib/rails/generators.rb:293:in `lookup'
/home/hs/.rvm/gems/ruby-1.9.3-p0/gems/railties-3.2.1/lib/rails/generators.rb:151:in `find_by_namespace'
/home/hs/.rvm/gems/ruby-1.9.3-p0/gems/railties-3.2.1/lib/rails/generators/base.rb:345:in `prepare_for_invocation'
/home/hs/.rvm/gems/ruby-1.9.3-p0/gems/thor-0.14.6/lib/thor/group.rb:145:in `_invoke_from_option_template_engine'
/home/hs/.rvm/gems/ruby-1.9.3-p0/gems/thor-0.14.6/lib/thor/task.rb:22:in `run'
/home/hs/.rvm/gems/ruby-1.9.3-p0/gems/thor-0.14.6/lib/thor/invocation.rb:118:in `invoke_task'
/home/hs/.rvm/gems/ruby-1.9.3-p0/gems/thor-0.14.6/lib/thor/invocation.rb:124:in `block in invoke_all'
/home/hs/.rvm/gems/ruby-1.9.3-p0/gems/thor-0.14.6/lib/thor/invocation.rb:124:in `each'
/home/hs/.rvm/gems/ruby-1.9.3-p0/gems/thor-0.14.6/lib/thor/invocation.rb:124:in `map'
/home/hs/.rvm/gems/ruby-1.9.3-p0/gems/thor-0.14.6/lib/thor/invocation.rb:124:in `invoke_all'
/home/hs/.rvm/gems/ruby-1.9.3-p0/gems/thor-0.14.6/lib/thor/group.rb:226:in `dispatch'
/home/hs/.rvm/gems/ruby-1.9.3-p0/gems/thor-0.14.6/lib/thor/invocation.rb:109:in `invoke'
/home/hs/.rvm/gems/ruby-1.9.3-p0/gems/thor-0.14.6/lib/thor/group.rb:269:in `block in _invoke_for_class_method'
/home/hs/.rvm/gems/ruby-1.9.3-p0/gems/thor-0.14.6/lib/thor/shell.rb:74:in `with_padding'
/home/hs/.rvm/gems/ruby-1.9.3-p0/gems/thor-0.14.6/lib/thor/group.rb:258:in `_invoke_for_class_method'
/home/hs/.rvm/gems/ruby-1.9.3-p0/gems/thor-0.14.6/lib/thor/group.rb:150:in `_invoke_from_option_scaffold_controller'
/home/hs/.rvm/gems/ruby-1.9.3-p0/gems/thor-0.14.6/lib/thor/task.rb:22:in `run'
/home/hs/.rvm/gems/ruby-1.9.3-p0/gems/thor-0.14.6/lib/thor/invocation.rb:118:in `invoke_task'
/home/hs/.rvm/gems/ruby-1.9.3-p0/gems/thor-0.14.6/lib/thor/invocation.rb:124:in `block in invoke_all'
/home/hs/.rvm/gems/ruby-1.9.3-p0/gems/thor-0.14.6/lib/thor/invocation.rb:124:in `each'
/home/hs/.rvm/gems/ruby-1.9.3-p0/gems/thor-0.14.6/lib/thor/invocation.rb:124:in `map'
/home/hs/.rvm/gems/ruby-1.9.3-p0/gems/thor-0.14.6/lib/thor/invocation.rb:124:in `invoke_all'
/home/hs/.rvm/gems/ruby-1.9.3-p0/gems/thor-0.14.6/lib/thor/group.rb:226:in `dispatch'
/home/hs/.rvm/gems/ruby-1.9.3-p0/gems/thor-0.14.6/lib/thor/base.rb:389:in `start'
/home/hs/.rvm/gems/ruby-1.9.3-p0/gems/railties-3.2.1/lib/rails/generators.rb:170:in `invoke'
/home/hs/.rvm/gems/ruby-1.9.3-p0/gems/railties-3.2.1/lib/rails/commands/generate.rb:12:in `<top (required)>'
/home/hs/.rvm/gems/ruby-1.9.3-p0/gems/activesupport-3.2.1/lib/active_support/dependencies.rb:251:in `require'
/home/hs/.rvm/gems/ruby-1.9.3-p0/gems/activesupport-3.2.1/lib/active_support/dependencies.rb:251:in `block in require'
/home/hs/.rvm/gems/ruby-1.9.3-p0/gems/activesupport-3.2.1/lib/active_support/dependencies.rb:236:in `load_dependency'
/home/hs/.rvm/gems/ruby-1.9.3-p0/gems/activesupport-3.2.1/lib/active_support/dependencies.rb:251:in `require'
/home/hs/.rvm/gems/ruby-1.9.3-p0/gems/railties-3.2.1/lib/rails/commands.rb:29:in `<top (required)>'
script/rails:6:in `require'
script/rails:6:in `<main>'
error slim [not found]
invoke test_unit
identical test/functional/posts_controller_test.rb
invoke helper
identical app/helpers/posts_helper.rb
invoke test_unit
identical test/unit/helpers/posts_helper_test.rb
invoke assets
invoke coffee
identical app/assets/javascripts/posts.js.coffee
invoke scss
identical app/assets/stylesheets/posts.css.scss
invoke scss
identical app/assets/stylesheets/scaffolds.css.scss
We can not update to rails 4.2 becuase of the dependency on 'actionmailer' gem:
$ bundle update rails
Fetching gem metadata from https://rubygems.org/.........
Resolving dependencies...
Bundler could not find compatible versions for gem "actionmailer":
In Gemfile:
slim-rails (>= 0) ruby depends on
actionmailer (< 4.2, >= 3.0) ruby
rails (= 4.2.0) ruby depends on
actionmailer (4.2.0)
After trying to access my slim views I get the following error:
ActionView::MissingTemplate at /patients
Missing template patients/index, application/index with {:locale=>[:en], :formats=>[:html], :handlers=>[:erb, :builder, :raw, :ruby, :haml]}.
Searched in: * "/home/pablo/code/rails/tarjira/app/views"
I can see that :slim
doesn't appear as a handler.
I have slim-rails
in the gemfile but it doesn't work. The views, obviously exists too:
❯❯❯ ls -l app/views/patients
total 20K
-rw-r--r-- 1 pablo users 298 abr 9 12:46 _form.html.slim
-rw-r--r-- 1 pablo users 101 abr 9 12:46 edit.html.slim
-rw-r--r-- 1 pablo users 358 abr 9 12:46 index.html.slim
-rw-r--r-- 1 pablo users 66 abr 9 12:46 new.html.slim
-rw-r--r-- 1 pablo users 101 abr 9 12:46 show.html.slim
Edit: I'm using Rails 4.0.4
I am using slim templates for my rails application. But something strang is happening. In my application template I have a form like so:
= form_tag search_path, class:'navbar-search pull-left', remote: true
= text_field_tag :term, nil, class: 'search-query span2', placeholder: 'Search'
That renders well on my page and the search form is working fine. However in my sign up partial I have:
= form_tag '/auth/identity/callback'
- if @identity && @identity.errors.any?
div.error
h2 =pluralize(@identity.errors.count, 'error')
|prohibited this account from being saved:
ul
- @identity.errors.full_messages.each do |msg|
li =msg
h1
i.iconbig-lock
| Sign In
div.login-fields
p Sign In using your email:
div.field
= label_tag :auth_key, 'Email'
= text_field_tag :auth_key, nil, class: 'input login username-field', placeholder: 'Email'
div.field
= label_tag :password, 'Password'
= password_field_tag :password, nil, class:'login password-field', placeholder: 'password'
div.login-actions
= submit_tag 'Login', class: 'btn-signin btn btn-primary'
div.login-social.marg10-btm
p Sign in using social network:
a.btn
= image_tag 'twitter-18.png'
| Signin with twitter
a.btn href="/auth/facebook"
= image_tag 'facebook-18.png'
| Signin with Facebook
the form tag doesn't render, but all sub elements text fields (including the 'authenticity_token') renders fine.
I play around abit and notice that the page only allow 1 form_tag. Ones created after the first never renders. I been looking on google for a while and could not figure why. Any ideas?
Hi!
I use slim-rails
gem version 3.0.1 and I have seen that slim removes implicit whitespaces declared with >
or <
. For example if I use:
span => my_variable_string
/ or
span =< my_variable_string
Slim definition
Output with trailing white space =>
. Same as the single equal sign (=), except that it adds a trailing white space.
Output with leading white space =<
. Same as the single equal sign (=), except that it adds a leading white space.
The code shows me a whitespace after or before but using the HTML minification (option pretty: false
), it removes the implicite whitespaces. Any idea?
The change at this commit a845a7b introduced a problem where there is a difference between development mode and production mode. Normally, pretty-printing in development mode should have no impact on behavior from production mode, however, this is not the case.
With pretty mode enabled on slim-rails 3.0.1, the resulting HTML code is incorrectly generated, leading to rendering problems. Specifically, if you have the following slim code:
span before
span = " middle "
span after
it results in the following incorrect HTML:
<span>before</span><span>middle </span><span>after</span>
Note the missing leading space from the middle span. This causes the webpage to render the text as:
beforemiddle after
Whereas, if the pretty mode was disabled (like it is for production), the following HTML is generated:
<span>before</span><span> middle </span><span>after</span>
resulting in the rendering of
before middle after
Although the pretty formatting issue comes from a dependency gem, I believe that opting everyone into pretty-formatting mode by default may be problematic. I will try to locate the pretty formatting bug within the 'slim' gem or one of its dependencies but I wanted to file this issue here as well. Any guidance on where to fix the problem would be appreciated.
Hi All,
We are getting:
DEPRECATION WARNING: asset_path with two arguments is deprecated.
We are using rails 4.0.3
Regards,
Alex
I've hit an issue with inline if statements:
Rails 3.2:
#Item class="#{"error" unless f.object.errors.empty?}"
Would not have any issues and I have this throughout my app, however in rails 4 it raises an indentation error (or when surrounded by [] brackets, it raises an invalid attribute error)
Workaround:
Rails4:
#Item class=("error" unless f.object.errors.empty?)
It seems removing the "#{}" out of the equation seems to help the problem.
missing a colon :
From slim-rails.rb
:
initializer 'slim_rails.configure_template_digestor' do |app|
puts "Register: slim; #{app.assets}, #{app.assets.inspect}, #{app.assets.class.to_s}"
if app.assets && app.assets.respond_to?(:register_engine)
app.assets.register_engine '.slim', Slim::Template
end
... gives me this:
Nigel-MBP:ctbe wtfiwtz$ rs
Register engine: .coffee, Sprockets::CoffeeScriptProcessor, {:mime_type=>"application/javascript"}
Register engine: .jst, Sprockets::JstProcessor, {:mime_type=>"application/javascript"}
Register engine: .eco, Sprockets::EcoProcessor, {:mime_type=>"application/javascript"}
Register engine: .ejs, Sprockets::EjsProcessor, {:mime_type=>"application/javascript"}
Register engine: .sass, Sprockets::SassProcessor, {:mime_type=>"text/css"}
Register engine: .scss, Sprockets::ScssProcessor, {:mime_type=>"text/css"}
Register engine: .erb, Sprockets::ERBProcessor, {:mime_type=>"text/plain"}
=> Booting WEBrick
=> Rails 4.2.5.1 application starting in development on http://localhost:3000
=> Run `rails server -h` for more startup options
=> Ctrl-C to shutdown server
Register: slim; , nil, NilClass
Register engine: .sass, Sass::Rails::SassTemplate, {}
Register engine: .scss, Sass::Rails::ScssTemplate, {}
[2016-02-21 13:19:03] INFO WEBrick 1.3.1
[2016-02-21 13:19:03] INFO ruby 2.2.3 (2015-08-18) [x86_64-darwin15]
[2016-02-21 13:19:03] INFO WEBrick::HTTPServer#start: pid=48242 port=3000
So app.assets is not defined on Sprockets v3.5.2.
Sprockets 4.x will also not use Tilt anymore, so there might be issues with Rails 5 as well. See #100.
I am building a Rails engine. I would like to use Slim Rails in the engine. When I do generate controller etc the views are in ERB. When I tried to require 'slim-rails'
in engine.rb
file it says there is no such required.
Is it possible to use Slim Rails in an engine. If so is this a bug or am I doing it wrong. As I remember if I just bundle install
slim rails in a Rails app it just works.
Thanks in advance.
After adding slim-rails to the Gemfile and bundling, now getting the following error when trying to start the server:
~/Dev/ (dev) $ ./run.sh bin/rails:6: warning: already initialized constant APP_PATH /Users/typeoneerror/Dev/bin/rails:6: warning: previous definition of APP_PATH was here Usage: rails COMMAND [ARGS]
I was just running a generator running rails 4.2.1 and I saw this error where the slim templates do not get generated
bundle exec rails g scaffold RegressionRun regression:references ...
...
invoke scaffold_controller
identical app/controllers/regression_runs_controller.rb
error slim [not found]
invoke rspec
...
And slim works well otherwise in the app for a long time. I tried to run rails bare and also with bundle exec rails generate ....
Using slim 3.0.4.
I could not find where this comes from by searching around. Any ideas what could be happening here?
Error:
https://gist.github.com/1145183
Bundler install ran fine, but after a Pow restart, I get this error.
When generating scaffolds, slim views were generated, but I got the above error.
Other issues seemed to mention that the gem was only available on github, but that you duplicated it on RubyGems.
I apologize if I am doing something obviously wrong.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.