rmosolgo / react-rails-hot-loader

Live-reload React.js components with Ruby on Rails & react-rails
MIT License
88 stars 24 forks source link

Configurable asset glob #4

Closed willcosgrove closed 9 years ago

willcosgrove commented 9 years ago

Per your recommendation on #3. Hopefully this resembles what you had in mind! If not, let me know, and I'll get it fixed.

rmosolgo commented 9 years ago

Woaaahh I did not know that cattr_accessor actually used a class attribute. I thought its whole point was to avoid the dangers of class attributes. I wonder if I've ever actually used it anywhere!

Ok, sorry I said AssetPath but I realize now that AssetPath is used for the path to the bundled JS, not the path to the files to reload :S Kind of dumb of me to get those mixed up. Do you mind moving that config back to AssetChangeSet? Sorry I got confused :weary:

willcosgrove commented 9 years ago

No worries, yeah I thought it looked like a funny place for it. I'll move that over to AssetChangeSet.

Do you want to stick with cattr_accessor, or move to some other solution?

rmosolgo commented 9 years ago

I think cattr_accessor is fine since nobody's extending that class, but I think the safest is:

class AssetChangeSet 
   # ...
   class << self 
     attr_accessor :asset_glob 
   end 
   self.asset_glob = "#{your_glob}"
end
rmosolgo commented 9 years ago

Ohhh, maybe this is what i was thinking of: http://apidock.com/rails/Class/class_attribute ¯(ツ)

willcosgrove commented 9 years ago

Ok, how does that look? I switched to class_attribute which basically is doing what you mentioned above. It's dependent on ActiveSupport, but since this whole gem is for Rails, I figure that's not a horrible thing.

rmosolgo commented 9 years ago

:money_with_wings: :confetti_ball:

rmosolgo commented 9 years ago

Shipped as 0.4.0

willcosgrove commented 9 years ago

Sweet, thanks!