My SellerDeck Account | Newsletter | Free Trial

Community and Knowledge Base

Go Back   Sellerdeck Community > Knowledge Base > Application Issues

Search powered by Google
Register FAQ Members List Search Today's Posts Mark Forums Read

Reply
 
Thread Tools Search this Thread Useful Thread? Display Modes
  #1  
Old 26-Jan-2015, 04:41 PM
G.W.Green G.W.Green is offline
Administrator
Join Date: Sep 2005
Full Name: G.W.Green
Posts: 480
Thanks: 0
Thanked 65 Times in 41 Posts
Re-compressing the JavaScript files after editing

SellerDeck added compressed JavaScript with SellerDeck 2014. This brings multiple JavaScript files into a single compressed file, saving download time.

The original JavaScript files are still available in the site and can be modified to implement non-standard functionality. However, if this is done then SellerDeck will upload the uncompressed original files (see the layout 'Standard Javascript Header Functions' for how this is done).

The compressed JavaScript file is called 'sellerdeck.min.js' and it contains compressed, or minified, code from actiniccore.js, actinicextras.js, actinicsearch.js, dynamic.js, recentproductssupport.js and responsive.js.

SellerDeck software does not feature a built-in JavaScript compressor as once compressed, as a rule the JavaScript files do not need to be recompressed.

It is possible to re-compress the files after editing by installing a compressor and following the instructions below.

The compressor of choice is 'Uglify', which is also used by jQuery; currently the best compressor available.

Installing Uglify is fairly easy; the batch files to compress our files are installed as standard in the site folder. The intention was that any designers modifying the scripts would be fairly competent and can easily re-compress them prior to shipping to the customer.

To install Uglify:

1. install 'node.js' using the Windows installer at:-

https://nodejs.org/en/download/

This should set up paths so that 'node.js' can be run from the command line.

NOTE: If that doesn't happen you may need to reboot.

2. Open a cmd command prompt and enter

npm install uglify-js@2 -g

and press return.

If this doesn't run you may have to change to the folder C:\Program Files (x86)\nodejs and run it directly from there.

There is a batch file to create a compressed sellerdeck.min.js in the site folder called:-

create_sellerdeck_min_pause.bat

Whenever the standard JavaScript has been changed run this batch file to recreate the sellerdeck.min.js file.

NOTE: If there is an error when running the batch file in the site, it's possible that you need to restart your computer so that uglify will work.

If you receive an error message: -

C:\Windows\system32>call create_sellerdeck_min.bat
'create_sellerdeck_min.bat' is not recognized as an internal or external command operable program or batch file.

C:\Windows\system32>pause
Press any key to continue . . .

Even when running as 'Administrator', this is because Windows is running the process in the 'System32' folder instead of the local directory.

This can be resolved by copying the file 'create_sellerdeck_min_pause.bat' and adding the line: -

Code:
chdir %~dp0
to the top of that file and saving it, then using this file when you edit the JavaScript files.

Note also that .map files are created and can be used by the debugger in Chrome.

For more information see http://www.elijahmanor.com/the-magic...-9-source-map/ . The jQuery map file has been included as standard as well as the uncompressed jQuery file.

If you are adding more JavaScript files then they can be added to the batch file and to sellerdeck.min.js; or you could compress them separately.

NOTE:
It is your responsibility to ensure how safe the files are, as this procedure and the consequences would not be supported by SellerDeck. You will find default copies of all the files within the folder 'Original' that sits under 'SellerDeck 2014' folder within the 'Program Files/Program Files (x86)' folder.
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



All times are GMT. The time now is 03:28 PM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.