npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@striblab/strib-ai2html

v0.1.0

Published

Helpful instructions, setup, and config for using ai2html

Downloads

10

Readme

Strib ai2html

Helpful instructions, setup, and config for using ai2html.

ai2html is an extremely helpful, open-source script for Adobe Illustrator that converts your Illustrator documents into html and css, specifically it exports a newsgraphic as an html page with html text that is layered over a background image. This is specifically helpful in making a graphic more responsive, performant, and SEO-friendly.

Install

Command line

This project provides a command line tool to help manage and install ai2html specific to the Star Tribune. You will need to have NodeJS installed. For Windows users, it's best to use the NodeJS prompt application that gets installed

  1. Install tool globally: npm install @striblab/strib-ai2html -g
  • To update, run the same command.

Note: In theory this tool could be used with npx, but doing that causes some odd errors. TODO: Revisit as npx allows users to use the newest version of the tool.

Script and templates

Run the following to compile and install the ai2html script and config, as well as the Strib template:

  1. Run: strib-ai2html install
    • More than likely you will need to be an administrator to run this, and may have to prefix the comand with sudo.

If you run into font checking issues, see the Fonts section below.

Fonts

We will need at least the Star Tribune web fonts for ai2html to generate correctly, and if you are converting print graphics, you will also want the Star Tribune print fonts. You will have to install fonts manually. Get the fonts from the Design department.

On a Mac:

  1. Open your local Font library folder at ~/Library/Fonts
    • This is a hidden folder, so it may be easier to do it on the command line with: open ~/Library/Fonts
  2. Copy or drag fonts into this folder.

On Windows:

  1. TODO

If you want to manually check if the web fonts can be found on your system, use the following command:

strib-ai2html fonts --check

Using ai2html

At the Star Tribune, the idea is that the produced file can be inserted into a Clickability article via an iframe via a strib-tag. It can fit inside the 525px standard middle column or you can hide the right column of the article and run it at 853px. It also has a version for mobile at 300px. Those are the 3 responsive sizes built into the template.

The strib-ai2html install command will install the templates found in templates/ into Illustrator. This means, you can do File > New From Template in Illustrator.

Project structure

An Illustrator project that is going to use ai2html should be structured like the following, where PROJECT-NAME should change based on your project, such as dancing-robots:

PROJECT-NAME/
  PROJECT-NAME.ai
  ai2html-config.json  <-- Optional
  ai2html-preview-template.html  <-- Optional, if you are not creating a full HTML version for embedding/iframe

You can see an example in tests/manual/simple-project/. You can get the ai2html-preview-template.html here.

When ai2html is run, you will end up with output similar to the following depending on certain options:

PROJECT-NAME/
  ai2html-output/
    PROJECT-NAME-mobile.png
    PROJECT-NAME-regular.png
    PROJECT-NAME-wide.png
    PROJECT-NAME.html  <-- HTML fragment version
    PROJECT-NAME.preview.html  <-- Full, embeddable HTML version based from preview template
  PROJECT-NAME-promo.png
  PROJECT-NAME.ai
  ai2html-preview-template.html

Settings

One of the main goals of this Strib-specific projects is to set some of the settings by default. ai2html has many settings. And there are a few ways to manage settings.

Often, you may not need to update any settings.

Config file

You can create an ai2html-config.json file next your Illustrator file. This is the preferred way, but not necessary. This will override any of the settings that we installed with this project.

Text block

ai2html will read specifically-named text blocks in your Illustrator file; these are just blocks of texts with a certain first line. If you include a ai2html-settings block, ai2html will attempt to read these as settings. The text block may look something like the following:

ai2html-settings
create_promo_image: yes
image_format: auto
responsiveness: dynamic

Lines that can't be parsed, such as // comments will show a warning but will not affect the output.

Artboards

See the artboards section on the ai2html page for more details. The template provided here has Strib standard size artboard provided.

Testing

Manual

A manual test can be found in tests/manual/simple-project/. Use Illustrator to open simple-project.ai and run ai2html to output. Then run a web server to see it embedded, such as http-server tests/manual/ and go to http://localhost:8080/embed-test.html in your browser.