0

I have lots of files in sub folders and I have to include them in an html file , i.e -

<script src="folder2/file1.js"></script>

for each file .

I'm looking for an easy way to run all the folders from a provided root folder and cause it to include to my index.html all the files .

i.e - for the folder with -

folder1>
    file1.js
    file2.js
folder2>
    file1.js 

it will be in the index.html -

<script src="folder1/file1.js"></script>
<script src="folder1/file2.js"></script>
<script src="folder2/file1.js"></script>

I don't want to concat them so please avoid from grunt concat suggestions .

Have you any smart idea ?

2
  • why do you want to achive this? usually this is not a good idea...how about minifying the scripts? stackoverflow.com/questions/9287823/… Commented May 31, 2016 at 14:52
  • I'm working on dev environment and it's hard to debug a contacted single file with thousands of lines . Commented May 31, 2016 at 14:54

1 Answer 1

1

I'd use grunt-include-source

That way, you avoid to use concat and get the expected result.

I'm not very familiar with it so I'd refer you to this SO answer

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

Comments

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.