Shopify / Shopify/liquid

Add source map for built HTML files

Open
#1,047 2 comments 4 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Feature Request
Dominant language
Ruby
Stars
11.9k
Forks
1.5k
Avg merge
17h 55m
Merged PRs (30d)
3

Description

Liquid can be thought of as an HTML compiler. This is similar to SASS CSS compiler or a Javascript minifier.

When debugging a compiled project, it can be helpful to know the origin of each line of the output. For example, if a built html project using liquid (maybe through Jekyll) may contain this HTML error: <img src="url"> (it is missing an alt tag). Normally it would require a human to figure out which include file this error originated from.

In modern times testing is usually done automatically (maybe Travis CI running against a website published on GitHub). It will be nice if the test errors, which are based on the built HTML, can be automatically traced back into the original source code, the Liquid files and partials includes.

There is a standard for this already and it is called Source Maps. This technology is widely used for CSS, JS and Solidity compilation as well as other languages I'm sure.

I believe this is the authoritative documentation:
https://docs.google.com/document/d/1U1RGAehQwRypUTovF1KRlpiOFze0b-_2gc6fAH0KY0k/edit

An implementing library: https://github.com/mozilla/source-map

Please consider to implement Source Maps for Liquid.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing the issue's Source Maps specification and the linked mozilla/source-map library, then trace how Liquid builds HTML and handles includes and partials. Done means generated HTML includes usable mappings back to the originating Liquid files and partials, with the behavior verified by tests.

Written by the indexing model from the issue text.

Assessment

Tech stack
ruby
Domain
compilers
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.