-2

I have a bash script that does the following:

  • Removes a CSS directory
  • Copies over new SASS from source
  • Runs gulp task to generate CSS again

After I copy the SASS over, I would like to do the following before generating CSS again:

Find any occurrence of ('/assets and change it to ('/themes/custom/mytheme/assets in any of the files in the SASS directory.

How can I do that?

2
  • 1
    What have you tried so far ? Some simple awk / sed could easily do that Commented Mar 13, 2017 at 16:00
  • Better replace the text in the SASS source with a variable and let SASS do the substitution... Commented Mar 13, 2017 at 17:10

1 Answer 1

0

As was already mentioned, this can be done for example with a basic sed substitution. The only thing to look out for, is to escape the slashes and to use -i to edit files in place.

sed -i "s/('\/assets/('\/themes\/custom\/mytheme\/assets/" /path/to/SASS/*

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

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.