Git Product home page Git Product logo

terminal4-postcss's Introduction

PostCSS Terminal4 Media Build Status

The Terminal 4 CMS utilizes tags similar to <t4 type="media" formatter="path/*" id=16 /> in order to reference the URLs for media images, fonts, and so on. This is problematic if you have crafted CSS locally and need to reference media files on Terminal 4. It’s especially a pain if you are working with a minified CSS file.

This PostCSS plugin allows you to easily search for file strings and replace them with their requisite IDs. You can then upload the resulting CSS file to Terminal Four and it will reference your media files appropriately.

From:

.foo {
    background_image: url(../whatever-vector.svg)
}

To:

.foo {
    background_image: url(<t4 type="media" formatter="path/*" id="16" />)
}

Usage

postcss([ require('postcss-terminal4-media')(opts) ])

Options:

Put all files into a map; the media_string and selectors values are optional; the defaults are shown below. {d} will be replaced with the resulting ID.

{
    "map": {
        "files": {
            "source": 25,
            "../images/example.jpg": 24
        }
    },
    "media_string": "<t4 type=\"media\" formatter=\"path/*\" id=\"{d}\" />",
    "selectors": ["background-image", "background", "src"]
}

terminal4-postcss's People

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.