All Projects → crossjs → postcss-flexible

crossjs / postcss-flexible

Licence: other
🔲 dpr/rem/url transformer for flexible

Programming Languages

CSS
56736 projects
javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to postcss-flexible

postcss-relaxed-unit
🍮Postcss-relaxed-unit is a postcss plugin for unit tranformation and make write css easier with custom unit.
Stars: ✭ 44 (+131.58%)
Mutual labels:  postcss, rem
postcss-rem
PostCSS plugin to use rem units with optional pixel fallback.
Stars: ✭ 14 (-26.32%)
Mutual labels:  postcss, rem
postcss-inline-base64
PostCSS plugin used to replace value inside of url function to base64
Stars: ✭ 23 (+21.05%)
Mutual labels:  url, postcss
react-cli
基于 create-react-app 搭建的前端脚手架
Stars: ✭ 18 (-5.26%)
Mutual labels:  postcss, rem
mobileweb
webpack 5 + postcss 8 构建移动端网站架子
Stars: ✭ 23 (+21.05%)
Mutual labels:  postcss, rem
kzilla.xyz
Shorten the URL. Broaden the reach.
Stars: ✭ 34 (+78.95%)
Mutual labels:  url
craft3-webpack5-tailwind2-boilerplate
A real-world boilerplate for Craft CMS 3 projects that leverages Wepback 5, Tailwind 2, PostCSS 8, and has a hot-reload dev environment. Now with dynamic imports, asynchronous chunk loading, and legacy vs modern browser support!
Stars: ✭ 44 (+131.58%)
Mutual labels:  postcss
postcss-prefixwrap
A PostCSS plugin that is used to wrap css styles with a css selector to constrain their affect on parent elements in a page.
Stars: ✭ 54 (+184.21%)
Mutual labels:  postcss
Odyssey
A piece of software that shows a traceroute of a URL redirect path
Stars: ✭ 41 (+115.79%)
Mutual labels:  url
postcss-gtk
Processes GTK+ CSS into browser CSS
Stars: ✭ 23 (+21.05%)
Mutual labels:  postcss
postcss-windicss
PostCSS integrations for Windi CSS
Stars: ✭ 33 (+73.68%)
Mutual labels:  postcss
github-base
Simple, opinionated node.js interface for creating basic apps with the GitHub API.
Stars: ✭ 58 (+205.26%)
Mutual labels:  url
criteria-of-quality-frontend
Критерии качественной вёрстки (разметка, стилизация, картинки, шрифты, автоматизация и пр.)
Stars: ✭ 26 (+36.84%)
Mutual labels:  postcss
All-Url-Uploader
A simple telegram Bot, Upload Media File| video To telegram using the direct download link. (youtube, Mediafire, google drive, mega drive, etc)
Stars: ✭ 122 (+542.11%)
Mutual labels:  url
relateurl
Create a relative URL with options to minify.
Stars: ✭ 52 (+173.68%)
Mutual labels:  url
bootstrap-shopify-theme
🛍 A free Shopify Theme built with Bootstrap, BEM, Liquid, Sass, ESNext, Theme Tools, ... and Webpack.
Stars: ✭ 41 (+115.79%)
Mutual labels:  postcss
styled-jsx-plugin-postcss
Plugin to add PostCSS support to styled-jsx.
Stars: ✭ 86 (+352.63%)
Mutual labels:  postcss
postcss-styled
PostCSS syntax for parsing styled components
Stars: ✭ 53 (+178.95%)
Mutual labels:  postcss
remote-origin-url
Extract the git remote origin URL from your local git repository.
Stars: ✭ 15 (-21.05%)
Mutual labels:  url
go-types
Library providing opanapi3 and Go types for store/validation and transfer of ISO-4217, ISO-3166, and other types.
Stars: ✭ 14 (-26.32%)
Mutual labels:  url

postcss-flexible

This is a postcss plugin for translating dpr(...), rem(...), url(...). Similar to px2rem, but using custom function istead of comments for syntax.

Travis Coveralls dependencies devDependency Status NPM version

Usage

Webpack

module.exports = {
  module: {
    loaders: [
      {
        test: /\.css$/,
        loader: "style-loader!css-loader!postcss-loader"
      }
    ]
  },
  postcss: function() {
    // remUnit defaults to 75
    return [require('postcss-flexible')({remUnit: 75})]
  }
}

Example

Before processing:

.selector {
  font-size: dpr(32px);
  width: rem(75px);
  line-height: 3;
  /* replace all @[1-3]x in urls: `/a/@2x/x.png`, `/a@2x/x.png` or `/a/[email protected]` */
  background-image: url(/images/[email protected]);
}

After processing:

.selector {
  width: 1rem;
  line-height: 3;
}

[data-dpr="1"] .selector {
  font-size: 16px;
  background-image: url(/images/[email protected]);
}

[data-dpr="2"] .selector {
  font-size: 32px;
  background-image: url(/images/[email protected]);
}

[data-dpr="3"] .selector {
  font-size: 48px;
  background-image: url(/images/[email protected]);
}

options

  • desktop: boolean, default false
  • baseDpr: number, default 2
  • remUnit: number, default 75
  • remPrecision: number, default 6
  • addPrefixToSelector: function
  • dprList: array, default [3, 2, 1]
  • fontGear: array, default [-1, 0, 1, 2, 3, 4]
  • enableFontSetting: boolean, default false
  • addFontSizeToSelector: function
  • outputCSSFile: function

Change Log

0.5.0

  • add: generate different css files with fontGear
  • support custom fontGear
  • support custom enableFontSetting
  • support custom addFontSizeToSelector
  • support custom outputCSSFile

0.4.0

  • support custom dprList

0.3.0

  • add option desktop and addPrefixToSelector

0.1.0

  • handle url()

0.0.3

  • add dpr() and rem()

0.0.0

  • First release.

License

MIT

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].