techjacker / node-version-assets

Version your static assets with MD5 hashes using node.js
MIT License
63 stars 11 forks source link

RequireJS problem when script name is main.js #5

Closed vesse closed 11 years ago

vesse commented 11 years ago

Given you have the following HTML document

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

and the following config for node-version-assets:

var Version = require("node-version-assets");
var versionInstance = new Version({
    assets: ['public/js/modules/main.js'],
    grepFiles: ['public/index.html'],
    keepOriginalAndOldVersions: true,
    requireJs: true
});
versionInstance.run();

then executing node config.js will replace also the main part of data-main attribute in HTML document's script tag loading RequireJS. The output is:

<script data-main.d41d8cd98f00b204e9800998ecf8427e="/js/modules/main.d41d8cd98f00b204e9800998ecf8427e" src="/js/vendor/require.js"/>
techjacker commented 11 years ago

Thanks for spotting this.

I just checked in a fix: https://github.com/techjacker/node-version-assets/commit/bf442c9ce64f6e8681f94838dfca36263130885d

vesse commented 11 years ago

Works now. Thanks for fixing this so quick!