A
A
Arris2015-05-30 10:38:41
Grunt.js
Arris, 2015-05-30 10:38:41

Does grunt-concat have analogues that support import (in a file)?

Please tell me a grunt plugin similar to grunt-concat, but it understands import directives in the collected files:
Something
@import 'foo/bar.md'
like this - should insert the contents of foo/bar.md in place of this line
It is clear that bar.md can also contain import directives.
My google-fu didn't help me. All found plug-ins do not do the right thing.
Thank you!

Answer the question

In order to leave comments, you need to log in

1 answer(s)
K
Konstantin Kitmanov, 2015-05-30
@Arris

I wrote my task , it's not difficult.
We read the file , go through the regular expression, find the file names, replace, write the file where it should be.
The replacement will look something like this:

fileContent = fileContent.replace(/@import '(\S+)'/mg, function (match, filepath) {
    return grunt.file.read(filepath)
})

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question