Permalink
Browse files

Added filter for the web builder service

  • Loading branch information...
gseguin committed Mar 29, 2012
1 parent d8501cc commit 3ef15b89cc878739291a7649e108e0628ae8e67c
Showing with 13 additions and 0 deletions.
  1. +13 −0 build/filter.js
View
@@ -0,0 +1,13 @@
+// This file is used by the AMD web builder service.
+// When the micro modules are used the version is pulled as a text module.
+// When building with r.js we need to replace the version token by its value since we strip the AMD layer with the pragma.
+
+var fs = require( 'fs' ),
+ path = require( 'path' ),
+ buildDir = __dirname,
+ versionRegExp = /__version__/g,
+ version = fs.readFileSync( path.join( buildDir, "../version.txt" ), "utf8" ).trim();
+
+module.exports = function ( contents ) {
+ return contents.replace( versionRegExp, '"' + version + '"' );
+};

0 comments on commit 3ef15b8

Please sign in to comment.