sennett sennett - 1 year ago 62
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?

Answer Source

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.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download