mockko / livereload

LiveReload applies CSS/JS changes to Safari or Chrome w/o reloading the page (and autoreloads the page when HTML changes)
http://livereload.com/
1.18k stars 56 forks source link

De-hardcode list of known file extensions #3

Closed dottedmag closed 14 years ago

dottedmag commented 14 years ago

Use command-line arguments instead.

NV commented 14 years ago

Or maybe you should consider using XRefresh config file?

andreyvit commented 14 years ago

I think I favour the config file approach. Not sure I want to use the XRefresh one, though — configs clearly need to be per-project.

NV commented 14 years ago

Would be nice to have both global config and configs per project.

bitboxer commented 14 years ago

what about a .livereload yml file in the project dir?

andreyvit commented 14 years ago

My current plan is to have a Ruby DSL-based config. It's just as clean as YAML, but allows you to throw in a line of code or two for really complex setups.

I'm also considering to name that config “Rakefile” :-) — i.e. just have you include the config into Rakefile, like:

require 'livereload'
LiveReload do |config|
  config.include '*.haml'
  config.exclude 'bar*'
  config.exclude /some.*reg.*exp/
  config.exclude { |path| really_complex_test(path) }
end

livereload would then simply launch rake livereload. Seems simple and consistent that way, although may be confusing to non-rubists.

Any objections / thoughts?

bitboxer commented 14 years ago

Sounds good for me.

NV commented 14 years ago

Not sure about Rake, but API looks sexy.

jeroenvandijk commented 14 years ago

Here is a simple solution to this problem:

http://github.com/jeroenvandijk/livereload/commit/f10be2dd371b09b51dacfbccd8238f67c4952fda

Not sure if it is the best but it works for me

bitboxer commented 14 years ago

Eval? No, I don't think that's a good solution. YML or a Rakefile would be far better.

jeroenvandijk commented 14 years ago

YAML would be my favorite as well, but this was the smallest change in the code to achieve the same and I thought would be nice to share. Is anyone already working on this?

andreyvit commented 14 years ago

If it's a consensus here that everyone prefers YAML, I'm ready to add it today or tomorrow unless someone else wants to take on the task.

andreyvit commented 14 years ago

Okay, I'm starting work on configuration. Feel free to drop by on livereload@jaconda.im (just add it to your Jabber / Google Talk) if you want to participate in defining the config format.

andreyvit commented 14 years ago

Done and released in 1.3. See README for config file details (in short: .livereload, Ruby, autocreated).

@jeroenvandijk Big thanks, you have truly inspired the syntax. I would never go for such simple syntax without your sample. I didn't use eval, however — applied a trick with method_missing to provide a top-level config object to the config file. I believe error reporting will be a lot more friendly this way.

andreyvit commented 14 years ago

(Forgot to close.)

jeroenvandijk commented 14 years ago

@andreyvit Thanks for your work. I think you went for right approach, mine was just quick and dirty. I tested this new feature and it works great! Keep up the good work!