• Stars
    star
    221
  • Rank 179,773 (Top 4 %)
  • Language
    JavaScript
  • License
    Apache License 2.0
  • Created over 5 years ago
  • Updated almost 2 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

🌲 Get back to HTML.

Trimmings logo

Trimmings

What happens to your web development process when you can focus on designing views and stop thinking about how to stitch them together? Trimmings by Postlight is a zero-configuration JavaScript library that adds a layer of smooth and fast in-page interaction to your web pages. All you have to do is add some hints to the HTML you already have.

Read more about it in our introduction to Trimmings.

This project follows in the footsteps of libraries like Turbolinks and Stimulus. It believes that the best place for your business and rendering logic is on the server, that you should send your users HTML, and that JavaScript is best suited for progressively-enhanced DOM manipulation. Trimmings is a set of patterns that allow you to add DOM manipulation to your app by adding data-trimmings-* attributes to your interactive elements. Less JavaScript in your project means less risk.

Once you've built your website and it's serving HTML that's presented the way you like it, you can start adding Trimmings hints that will enhance the way your interactions behave.

Perhaps you have a link to a detail page that you'd like to open in a modal. The standalone page probably has a header and footer that you wouldn't want to render in your modal. That's no problem. Just add an inline hint to your link:

<a data-trimmings-inline="from: .detail-container, to: .modal-container" href="/photos/2">
  View as a modal
</a>

If your visitor clicks that link, the page will be fetched in the background, the element with the detail-container class will be extracted from the result, and it will be inserted in an element with the modal-container class that's already on the page. You can write CSS that will make this show up however you like. Now you have a modal! That's all there is to it!

Installation

Just include trimmings.js in your <head>. That's it. Trimmings will automatically activate when your page loadsβ€”no need to think about lifecycles.

<script src="/trimmings.js"></script>

Usage

Trimmings features are enabled on specific elements by adding data-trimmings-* attributes. For more details on usage of each Trimmings feature, please consult the Trimmings handbook.

License

Licensed under either of

at your option.

Contributing

If you've found a bug or you'd like to propose a new feature, submit an issue and let's talk about it!

We expect that all contributors to Trimmings will abide by our Code of Conduct.

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.


πŸ”¬ A Labs project from your friends at Postlight. Happy coding!

More Repositories

1

parser

πŸ“œ Extract meaningful content from the chaos of a web page
JavaScript
5,062
star
2

headless-wp-starter

πŸ”ͺ WordPress + React Starter Kit: Spin up a WordPress-powered React app in one step
JavaScript
4,367
star
3

awesome-cms

πŸ“š A collection of open and closed source Content Management Systems (CMS) for your perusal.
2,711
star
4

serverless-typescript-starter

πŸ—„πŸ™…β€β™€οΈ Deploy your next serverless JavaScript function in seconds
TypeScript
713
star
5

lux

Build scalable, Node.js-powered REST JSON APIs with almost no code.
JavaScript
571
star
6

liftoff

πŸš€ Liftoff is a flexible static-site generator that pulls content from Airtable
JavaScript
343
star
7

parser-api

πŸš€ A drop-in replacement for the Postlight Parser API.
JavaScript
280
star
8

nodejs-typescript-kit

πŸ›  Node.js + TypeScript with all the goods: A zero-to-coding starter kit with all the modern tooling baked in.
JavaScript
107
star
9

account

πŸ“šοΈ βž• πŸ”’ Tell little stories with numbers
JavaScript
107
star
10

cloudflare-worker-app-kit

☁✨ A handy set of tools for creating a Cloudflare Worker app.
JavaScript
85
star
11

glide

☁ 🎑Modernize Salesforce API access with GraphQL
TypeScript
77
star
12

react-google-sheet-to-chart

πŸ“Š React component that renders Google Sheets as attractive charts with minimum effort
JavaScript
63
star
13

wp-callisto-migrator

🌐 πŸ‘‰ πŸ“‹ Migrate any content to WordPress in a few clicks
PHP
33
star
14

robo-chart-web

πŸ“Š Transform Google sheets to pretty charts!
JavaScript
27
star
15

lorem-ipsum-generator-generator

🎰 Generate a lorem ipsum generator site using Mercury Web Parser
HTML
26
star
16

secretmsg

πŸ•΅ Encrypt messages for easy sharing
TypeScript
23
star
17

generate-awesome

πŸ–¨ A command-line tool for generating Awesome Lists from a set of data files.
JavaScript
22
star
18

mercury-rs

The official Rust client for the Mercury Parser
Rust
16
star
19

ci-failed-test-reporter

πŸ“ A tool for posting failing test results to GitHub PRs
JavaScript
10
star
20

hubot-spotify-playlist

Allows the ability to add/remove/findTracks to a Spotify Playlist.
CoffeeScript
7
star
21

docker-lux

The official Docker image for Lux 🐳 πŸ”†
JavaScript
7
star
22

parser-api-express

Postlight Parser API express app
JavaScript
6
star
23

babel-preset-lux

A babel preset containing all of the plugins required by Lux.
JavaScript
6
star
24

lux-benchmarks

JavaScript
5
star
25

rollup-plugin-lux

A Rollup plugin for bundling Lux applications.
JavaScript
3
star
26

lux-rfcs

RFCs for changes to Lux
2
star
27

use-search-params

A simple react hook for query params.
TypeScript
2
star
28

seasons

πŸŒ” Calculates the astronomical season for a given date or year
TypeScript
1
star
29

hubot-pingboard

πŸ‘₯ A hubot script for interacting with Pingboard.com.
CoffeeScript
1
star