3

I have a local development web with an index.html which is using:

<!-- LESS -->
<link rel="stylesheet/less" type="text/css" href="css/styles.less" />
<script src="js/lib/less-1.1.3.min.js" type="text/javascript"></script>

When I am ready editing I commit/push to my development server and the git post-receive hook runs my build.sh and builds my css / requireJS / smartsprites app.

How can I replace the above code in my static HTML file with:

<link rel="stylesheet" type="text/css" href="css/styles.css" />

without switching to server-side scripting (PHP/etc) or on the fly node.js css rendering.

In my build.sh script? With regexp? How? An example would be nice.

1 Answer 1

2

You can just use sed:

sed -i -e 's/styles\.less/styles\.css/g' index.html

I haven't used git-post-receive (I didn't even know it existed! thanks :P), but you could just shove it into your build.sh file or whatever file runs when you push your files to the server.

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks for the git hook thing. I always manually change stuff every time I push my code, so this should make it much easier to manage.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.