sennett sennett - 6 months ago 15
HTML Question

How can I specify build pragmas in index.html?

I have an index.html file. I want to specify build pragmas in this file, so I can include my dev stuff when developing and specify production at build time.

Something like this:

<!DOCTYPE html>

<script src="bower_components/requirejs/require.js" data-main="scripts/baseRequireConfig.js"></script>

<script src="require.js" data-main="productionRequireConfig.js"></script>


Only using HTML pragmas rather than r.js ones. What are some options for this? node.js plugin? Some bash thing?


I ended up using sed to change the text

cat index.html |\
    sed s,bower_components/requirejs/require.js,require.js,g |\
    sed s,scripts/baseRequireConfig.js,productionRequireConfig.js,g \
    > build/index.html

Works for my current scale, but I wouldn't push it too far.