time-interactive

0.7.2 • Public • Published

The TIME.com Interactive Bootstrapper

Build Status Dependency Status

v0.7.2

Introduction

Our interactives at Time are developed independently from the CMS and bundled into self-assembling Javascript files using bundle-module, and external Webpack bundler maintained by Chris Wilson. They are both discrete--requiring no dependencies--and discreet--interfering as little as possible with the rest of the page.

You can also see the wiki for instructions on installation and usage.

Getting started

npm install -g time-interactive

This repository provides both a command-line script for generating new projects and a client-side script with a few convenience functions.

Generating a project

When globally installed, the module with bootstrap a project with the id you provide.

time-interactive [project_id]

If the script detects an existing time-interactive project by that name with an older version, it will ask you if you want to update.

Compiling

To bundle your project, you must have bundle-module globally installed:

npm install bundle-module -g

You can compile your interactive with either npm run build (development), which is loaded by index.html, or npm run minify, which is loaded by embed.html. You can also build the development version on every file change with npm run watch.

Building

Since v0.6.2, every project generated by the module had two Webpack configurations and a long list of development dependencies for local bundling. This meant every project had a busy node_modules directory and was frozen at the state of Webpack at the time it was generated, which is good and bad.

Seeing as all the Webpack configs and dependencies were redundant, I created a global Webpack bundler, bundle-module, that is always reasonably up-to-date and contains all the loaders you're likely to need, such as HTML/EJS templates, SASS/LESS, .\*sv, etc. At some future point, I may work in the option of a local webpack config, which is generally generated dynamically. In the meantime, if you need a loader that isn't present, please raise and issue or PR on the GitHub repo or, if you must, just e-mail me to complain :)

In cases were an old, "broken" module requires globals--here's looking at you, jQuery--the configuration file may need to be shimmed to execute correctly. This also may be required if using underscore templates.

Loaders

The following types of files may be imported in debug.js:

  • Text: using raw-loader
  • .css: using css-loader. This currently does resolve paths in url() calls. It allows uses the autoprefixer plugin to ensure browser compatibility.
  • .less and .scss: You can import .less and .scss files as well using less-loader and sass-loader. These are also autoprefixed.
  • .html and .ejs: The ejs-loader handles both .ejs templates and raw .html.
  • .csv, .tsv, .dsv: The dsv-loader can handle any delimited file.
  • .png, .jpg, .jpg, .gif: The file-loader plug can import images.

Readme

Keywords

none

Package Sidebar

Install

npm i time-interactive

Weekly Downloads

33

Version

0.7.2

License

MIT

Unpacked Size

29.2 kB

Total Files

18

Last publish

Collaborators

  • wilson428