All Projects → unlight → postcss-import-url

unlight / postcss-import-url

Licence: MIT license
PostCSS plugin inlines remote files.

Programming Languages

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

Projects that are alternatives of or similar to postcss-import-url

postcss-center
PostCSS plugin to center elements.
Stars: ✭ 44 (-6.38%)
Mutual labels:  postcss, postcss-plugin
Container Query
A PostCSS plugin and Javascript runtime combination, which allows you to write container queries in your CSS the same way you would write media queries.
Stars: ✭ 119 (+153.19%)
Mutual labels:  postcss, postcss-plugin
Postcss Less
PostCSS Syntax for parsing LESS
Stars: ✭ 93 (+97.87%)
Mutual labels:  postcss, postcss-plugin
Postcss Triangle
PostCSS plugin to create a triangle.
Stars: ✭ 57 (+21.28%)
Mutual labels:  postcss, postcss-plugin
Postcss Spiffing
PostCSS plugin to use British English
Stars: ✭ 158 (+236.17%)
Mutual labels:  postcss, postcss-plugin
Postcss Nested Props
PostCSS plugin to unwrap nested properties.
Stars: ✭ 58 (+23.4%)
Mutual labels:  postcss, postcss-plugin
Postcss Plugins
The "officially unofficial" consolidated list of PostCSS plugins in a ready-to-use package
Stars: ✭ 107 (+127.66%)
Mutual labels:  postcss, postcss-plugin
Postcss Register Custom Props
PostCSS plugin that transforms custom property registration in CSS to JS
Stars: ✭ 20 (-57.45%)
Mutual labels:  postcss, postcss-plugin
Postcss Rtl
PostCSS plugin for RTL-adaptivity
Stars: ✭ 143 (+204.26%)
Mutual labels:  postcss, postcss-plugin
Postcss Viewport Height Correction
PostCSS plugin to solve the popular problem when 100vh doesn’t fit the mobile browser screen.
Stars: ✭ 137 (+191.49%)
Mutual labels:  postcss, postcss-plugin
Postcss Import
PostCSS plugin to inline @import rules content
Stars: ✭ 1,048 (+2129.79%)
Mutual labels:  postcss, postcss-plugin
postcss-clearfix
PostCSS plugin that adds a 'fix' argument to the 'clear' property
Stars: ✭ 47 (+0%)
Mutual labels:  postcss, postcss-plugin
Postcss Alias
PostCSS plugin that allows you to create aliases for CSS properties
Stars: ✭ 47 (+0%)
Mutual labels:  postcss, postcss-plugin
Postcss Prefix Selector
Prefix all CSS rules with a selector
Stars: ✭ 75 (+59.57%)
Mutual labels:  postcss, postcss-plugin
Postcss Icon
PostCSS plugin that adds `css icons` from icon sets
Stars: ✭ 20 (-57.45%)
Mutual labels:  postcss, postcss-plugin
Rtlcss
Framework for transforming Cascading Style Sheets (CSS) from Left-To-Right (LTR) to Right-To-Left (RTL)
Stars: ✭ 1,363 (+2800%)
Mutual labels:  postcss, postcss-plugin
Postcss Interpolate
PostCSS plugin for values interpolation between breakpoints.
Stars: ✭ 9 (-80.85%)
Mutual labels:  postcss, postcss-plugin
Postcss Banner
PostCSS plugin to add text banner and footer to resulting file
Stars: ✭ 13 (-72.34%)
Mutual labels:  postcss, postcss-plugin
Postcss Aspect Ratio Mini
A PostCSS plugin to fix an element's dimensions to an aspect ratio
Stars: ✭ 123 (+161.7%)
Mutual labels:  postcss, postcss-plugin
postcss-trash-killer
It is a postcss plugin which wil be remove all unused css
Stars: ✭ 20 (-57.45%)
Mutual labels:  postcss, postcss-plugin

postcss-import-url

PostCSS plugin inlines remote files.

/* Input example */
@import 'https://fonts.googleapis.com/css?family=Tangerine';
body {
  font-size: 13px;
}
/* Output example */
@font-face {
  font-family: 'Tangerine';
  font-style: normal;
  font-weight: 400;
  src: url(https://fonts.gstatic.com/s/tangerine/v12/IurY6Y5j_oScZZow4VOxCZZM.woff2)
    format('woff2');
}
body {
  font-size: 13px;
}

Usage

const importUrl = require('postcss-import-url');
const options = {};
postcss([importUrl(options)]).process(css, {
  // Define a `from` option to resolve relative @imports in the initial css to a url.
  from: 'https://example.com/styles.css',
});

See PostCSS docs for examples for your environment.

Options

  • recursive (boolean) To import URLs recursively (default: true)
  • resolveUrls (boolean) To transform relative URLs found in remote stylesheets into fully qualified URLs (see #18) (default: false)
  • modernBrowser (boolean) Set user-agent string to 'Mozilla/5.0 AppleWebKit/537.36 Chrome/80.0.0.0 Safari/537.36', this option maybe useful for importing fonts from Google. Google check user-agent header string and respond can be different (default: false)
  • userAgent (string) Custom user-agent header (default: null)
  • dataUrls (boolean) Store fetched CSS as base64 encoded data URLs (default: false)

Known Issues

  • Google fonts returns different file types per the user agent. Because postcss runs in a shell, Google returns truetype fonts rather than the better woff2 format. Use option modernBrowser to explicitly load woff2 fonts.
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].