0 Replies - 3259 Views - Last Post: 10 October 2012 - 12:49 AM Rate Topic: -----

#1 bmson  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 10-October 12

Makefile that user cat to load html and sed to replace

Posted 10 October 2012 - 12:49 AM


Long time lurker but first time poster. I have a Makefile question and wasn't sure where to post the question but so I hope I picked the right category.

I'm working with backbone templates and have split my html in multiple files.
The index files includes this {template} text. I'm planing to use tha Makefile to load the text from multiple HTML files and replace the {template} variable with the content from those files.

My HTML files looks like this:

    <a href='#'>my link</a>


Then I have a makefile that looks like such:

    $(eval data := $(shell cat "file.html"))
    sed -i '' 's/$({template})/$(data)/' index.html

The sed code works lika a charm and it replaces it with the data value if I force it to have text, but the cat breaks and gives me an 'Error 1'

I've tried both...
$(eval data := $(shell grep -nr file.html))
$(eval data := $(shell cat "file.html"))

They both fail when they reach <, >, ", ' or #.
I've not yet figured out how to load the html data into the variable.

So I'm looking for guidance from you guys and girl.

Is This A Good Question/Topic? 0
  • +

Page 1 of 1