Skip to content
Mottie edited this page Sep 30, 2015 · 1 revision

Contributing

Requirements

  • Please follow the rules set by the .editorconfig in the root (learn more here) for all code.
  • Do not edit files outside of the src or _locales directory as many files in the root and all files in the dist are replaced.

Where we need help

  • Adding more language translations in the _locales directory (see the Language page for more information).
  • Creating a Safari extension. Hopefully, it won't be difficult to convert a Chrome extension into a Safari extension; but it's impossible to do if you don't own a Mac.
  • Adding more unit tests & browser testing of extensions using Selenium, or something similar.

Build Process

Installing Node.js & Grunt

  • Install Node.js - it includes npm (node package manager).
  • Open a command window in the tablesorter root directory.
  • Enter npm install to load all the necessary dependencies into the node_modules folder; this includes grunt.
  • Enter npm install -g grunt-cli to install the grunt command-line-interface globablly.
  • Now you are ready to run grunt!

The options.json file

  • This file contains class names & default settings.
  • The class names added to elements include ones that are injected into the page (preceeded by _printliminator_) and elements internal to the popup (iframe for bookmarklets) to make modifying these class names easier.
  • The file also contains the bookmarklet popup iframe height for when the keyboard commands list is open or closed.
  • The message options only apply to extensions.

Preprocess

  • For now, the build process uses preprocess which allows using directives to include or exclude blocks of code.
  • This includes adding settings from the options.json via /* @echo settings.XXXX */
  • When // @if MODE='EXT'...// @endif blocks are seen, it refers to extension-only code.
  • When // @if MODE='BOOKMARKLET'...// @endif blocks are seen, it refers to bookmarklet-only code.
  • This applies to many of the files in the src directory, including:
    • src/printliminator.js
    • src/printliminator.scss
    • src/bookmarklet/iframe.html
    • src/bookmarklet/iframe.scss
    • src/chrome/popup.html
    • src/chrome/popup.js
    • src/chrome/popup.scss
  • This was sort of copied from the method used by the author of Octotree which supports multiple browser extensions in one repository.
  • If you know of a better or more efficient method and are willing to contribute, pull requests are welcome!
  • Either way, I may end up breaking the printliminator.js file into modules specific for the bookmarklet and extension in the near future.

Using Grunt

  • If you would like to test any changes that you made to the repository, run grunt to perform a basic build.

    • A basic build creates all the folders within the dist folder for the bookmarklet & chrome; but it does not compress or convert the files
    • The bookmarklet files in the root: printliminator.min.js, bookmark.html and index.html are all updated.
    • Unit tests are so far only performed on the DOM traversing code.
  • Using grunt update will:

    • Update version numbers, using package.json as the source, in the manifest.json and printliminator.js files.
    • Create the chrome.zip in the dist folder.
    • Create the chrome.crx extension file... but I haven't found a use for it yet since the Chrome web store only accepts chrome.zip thus far.
    • Create the opera.nex extension file... again, Opera is so far only accepting the chrome.zip file.
Clone this wiki locally