emad-elsaid / dirtree

Visualizing files paths as an interactive tree, works nicely with gnu linux tools such as find, ls, or git ls-files
MIT License
118 stars 11 forks source link

Local dependencies #3

Closed akhal3d96 closed 7 years ago

akhal3d96 commented 7 years ago

You just drop the JavaScript libraries in the js directory and the gem will automatically load them when called with -largument, l for local.

akhal3d96 commented 7 years ago

Okay I wrote this in exe/dirtree file but I have no idea why the output html file doesn't work!

if options[:local_dependencies]
  scripts = result.scan(/(<script src="(.+)"><\/script>)/)
  script_t = scripts.transpose
  script_t[0].each do |script|
    src = script_t[1].shift 
    result.gsub!(script,"<script>#{open(src).read}</script>")
  end
end

The browser's console says there's something wrong with the jQuery snippet but I can't seem to find it. Help me senpai 😭.

akhal3d96 commented 7 years ago

changes.zip

emad-elsaid commented 7 years ago

1- use named group in your regular expression to get the src value 2- don't care about the browser console. open the output file and see what's written there if it's ok then look at the browser console.