Permalink
Browse files

simplify project structure, reintegrate source into single file

  • Loading branch information...
1 parent b088097 commit 292a21b0a0cb37325d55a9ecdfeaefe09c6bf0bf @bozz committed Nov 12, 2012
View
@@ -0,0 +1,11 @@
+#!/bin/sh
+
+if which uglifyjs &> /dev/null
+then
+ uglifyjs -o jquery.flowgallery.min.js jquery.flowgallery.js
+ echo "generated jquery.flowgallery.min.js"
+else
+ echo "Error: uglify-js not found, please make sure it's installed and in path."
+fi
+
+exit $?
View
@@ -1,71 +0,0 @@
-var fs = require("fs");
-
-desc('Generate FlowGallery release files');
-task('default', function (params) {
- console.log('Generating release version of plugin files...');
-
- var header = getHeader();
- var file = header + fs.readFileSync('../src/skeleton.js', 'utf8');
-
- file = replaceMarkerWithFileContents(file, 'utils');
- file = replaceMarkerWithFileContents(file, 'FlowGallery');
- file = replaceMarkerWithFileContents(file, 'FlowItem');
- file = replaceMarkerWithFileContents(file, 'plugin');
-
- var versionData = fs.readFileSync('../version.txt', 'utf8');
- file = file.replace(/{{Version}}/g, trim(versionData));
-
- var pluginFile = '../release/jquery.flowgallery.js';
- fs.writeFileSync(pluginFile, file);
- console.log("Successfully generated: " + pluginFile);
-
- file = header + uglifyFile(file);
- var compressedFile = '../release/jquery.flowgallery.min.js';
- fs.writeFileSync(compressedFile, file);
- console.log("Successfully generated: " + compressedFile);
-});
-
-
-// load header file (under /src/header.js) and replace 'Version' and
-// 'Date' placeholders
-var getHeader = function() {
- var headerData = fs.readFileSync('../src/header.js', 'utf8');
- // var versionData = fs.readFileSync('../version.txt', 'utf8');
- // headerData = headerData.replace('{{Version}}', trim(versionData));
- headerData = headerData.replace('{{Date}}', '(' + getDate() + ')');
- return headerData;
-}
-
-// search through 'file' for the 'marker' and if found
-// replace it by the contents of file with same name under /src
-var replaceMarkerWithFileContents = function(file, marker) {
- markerFilePath = '../src/' + marker + '.js';
- var markerFile = fs.readFileSync(markerFilePath, 'utf8');
- return file.replace('// {{' + marker + '}}', markerFile);
-}
-
-// use uglify-js module to generate compressed code
-var uglifyFile = function(file) {
- var jsp = require("uglify-js").parser;
- var pro = require("uglify-js").uglify;
-
- var ast = jsp.parse(file); // parse code and get the initial AST
- ast = pro.ast_mangle(ast); // get a new AST with mangled names
- ast = pro.ast_squeeze(ast); // get an AST with compression optimizations
- var finalCode = pro.gen_code(ast); // compressed code here
- return finalCode;
-}
-
-// util method for trimming whitespaces from string
-var trim = function(str) {
- return str.replace(/^\s+|\s+$/g,"");
-}
-
-// return current date in format 04-JUN-2012
-var getDate = function() {
- var d = new Date();
- var months = ['JAN','FEB','MAR','APR','MAY','JUN','JUL','AUG','SEP','OCT','NOV','DEC'];
- var day = d.getDate();
- if(day < 10) { day = "0" + day; }
- return day + "-" + months[d.getMonth()] + "-" + d.getFullYear();
-}
View
@@ -1,30 +0,0 @@
-
-# FlowGallery Build Documentation #
-
-The build script combines the seperate source files found under the
-"src" directory into a single file. Two different versions are created
-in this process - one that just contains the combined sources and the
-other is a compressed version aimed for production use.
-
-### Requirements and Setup for Build Script ###
-
-Node.js is used for the build scripts - tested with node 0.6.6
-(http://nodejs.org/).
-
-The actual build script was created using 'Jake'
-(https://github.com/mde/jake). It is recommended to install this
-globally (i.e. the "-g" option).
-
-npm install -g jake
-
-For compressing the code, the uglify-js module is used, install as
-follows:
-
-npm install uglify-js
-
-
-### Running the build script ###
-
-To run the build script simply call the "jake" command within the
-"build" directory. This will create the release version of the plugin
-files within the "release" directory.
View
@@ -76,10 +76,7 @@
<script src="js/jquery.easing.1.3.js" type="text/javascript"></script>
<!-- actual FlowGallery files -->
- <script src="../src/utils.js" type="text/javascript"></script>
- <script src="../src/FlowGallery.js" type="text/javascript"></script>
- <script src="../src/FlowItem.js" type="text/javascript"></script>
- <script src="../src/plugin.js" type="text/javascript"></script>
+ <script src="../jquery.flowgallery.js" type="text/javascript"></script>
<!-- initialize gallery -->
<script src="js/script.js" type="text/javascript"></script>
Oops, something went wrong.

0 comments on commit 292a21b

Please sign in to comment.