Skip to content

Plugin use cases: autoprefix, minify etc. #8

Description

@codepunkt

for style prefixing, inline-style-prefixer could be used. could also use cssnano (thanks @oliverturner for the idea) and autoprefixer postcss plugins - especially when performed at build time as opposed to runtime (needs babel/webpack plugins first)

Activity

  1. codepunkt commented on Jan 27, 2017

    @codepunkt
    OwnerAuthor

    @rofrischmann's inline-style-prefixer is around 8.5kb and 2.5kb when used in static mode. i'd rather not have this included, but it might be added as a plugin. A quick idea:

    plugin

    import Prefixer from 'inline-style-prefixer'
    
    export default (properties, options) => {
      const prefixer = new Prefixer(options)
      return prefixer.prefix(properties)
    }

    usage

    import spring from 'css-spring'
    import prefix from 'css-spring-prefixer'
    
    const keyframes = spring(
      { transform: '0deg' },
      { transform: '15deg' },
      { plugins: [ prefix ]},
    )

    After calculation of keyframes, plugins could be applied in the order they are defined - like this:

    plugins.forEach((plugin) => {
      const method = plugin.method || plugin
      const options = plugin.options || {}
    
      Object.keys(keyframes).forEach((percent) => {
        keyframes[percent] = method(keyframes[percent], options)
      })
    })
  2. self-assigned this
    on Jan 28, 2017
  3. changed the title [-]Auto-prefix[/-] [+]Plugin use cases: autoprefix, minify etc.[/+] on Feb 8, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions