1. 17 6月, 2020 1 次提交
    • R
      Use ES module syntax for application.js.tt and docs · 04cbaa14
      Ross Kaffenberger 提交于
      This change swaps the CommonJS require() syntax in the Webpacker
      application.js pack template file and in documentation examples with ES
      module import syntax.
      
      Benefits of this change include:
      
      Provides continuity with the larger frontend community: Arguably, one of
      the main draws in adopting Webpacker is its integration with Babel to
      support ES module syntax. For a fresh Rails install with Webpacker, the
      application.js file will be the first impression most Rails developers
      have with webpack and Webpacker.  Most of the recent documentation and
      examples they will find online for using other libraries will be based
      on ES module syntax.
      
      Reduces confusion: Developers commonly add ES imports to their
      application.js pack, typically by following online examples, which means
      mixing require() and import statements in a single file. This leads to
      confusion and unnecessary friction about differences between require()
      and import.
      
      Embraces browser-friendliness: The ES module syntax forward-looking and
      is meant to be supported in browsers. On the other hand, require()
      syntax is synchronous by design and not browser-supported as CommonJS
      originally was adopted in Node.js for server-side JavaScript. That
      webpack supports require() syntax is merely a convenience.
      
      Encourages best practices regarding optimization: webpack can statically
      analyze ES modules and "tree-shake", i.e., strip out unused exports from
      the final build (given certain conditions are met, including
      `sideEffects: false` designation in package.json).
      04cbaa14
  2. 12 5月, 2020 1 次提交
  3. 03 4月, 2020 1 次提交
  4. 28 12月, 2019 1 次提交
  5. 18 9月, 2019 1 次提交
  6. 10 3月, 2019 1 次提交
  7. 09 3月, 2019 1 次提交
  8. 25 1月, 2019 1 次提交
  9. 17 1月, 2019 1 次提交
  10. 11 1月, 2019 1 次提交
  11. 08 10月, 2018 1 次提交
  12. 24 4月, 2018 1 次提交
  13. 18 4月, 2018 1 次提交
    • J
      Use ImageProcessing gem for ActiveStorage variants · ca129685
      Janko Marohnić 提交于
      ImageProcessing gem is a wrapper around MiniMagick and ruby-vips, and
      implements an interface for common image resizing and processing. This
      is the canonical image processing gem recommended in [Shrine], and
      that's where it developed from. The initial implementation was extracted
      from Refile, which also implements on-the-fly transformations.
      
      Some features that ImageProcessing gem adds on top of MiniMagick:
      
        * resizing macros
          - #resize_to_limit
          - #resize_to_fit
          - #resize_to_fill
          - #resize_and_pad
        * automatic orientation
        * automatic thumbnail sharpening
        * avoids the complex and inefficient MiniMagick::Image class
        * will use "magick" instead of "convert" on ImageMagick 7
      
      However, the biggest feature of the ImageProcessing gem is that it has
      an alternative implementation that uses libvips. Libvips is an
      alternative to ImageMagick that can process images very rapidly (we've
      seen up 10x faster than ImageMagick).
      
      What's great is that the ImageProcessing gem provides the same interface
      for both implementations. The macros are named the same, and the libvips
      implementation does auto orientation and thumbnail sharpening as well;
      only the operations/options specific to ImageMagick/libvips differ. The
      integration provided by this PR should work for both implementations.
      
      The plan is to introduce the ImageProcessing backend in Rails 6.0 as the
      default backend and deprecate the MiniMagick backend, then in Rails 6.1
      remove the MiniMagick backend.
      ca129685
  14. 22 12月, 2017 1 次提交
  15. 29 11月, 2017 1 次提交
  16. 07 10月, 2017 1 次提交
  17. 17 9月, 2017 2 次提交
  18. 16 8月, 2017 1 次提交
  19. 12 8月, 2017 2 次提交
  20. 07 8月, 2017 1 次提交
    • A
      Extend image_tag to accept ActiveStorage Attachments and Variants (#30084) · 7c89948c
      Anton Khamets 提交于
      * Extend image_tag to accept ActiveStorage's Attachments and Variants
      
      * Flip resolve_image_source around
      
      * Add tests for the new use-cases of image_tag
      
      * Remove the higher-level test
      
      * Update image_tag documentation
      
      * Add error states into the test suite
      
      * Re-raise polymorhic_url's NoMethodError as ArgumentError
      
      * delegate_missing_to will raise DelegationError instead of NoMethodError
      7c89948c
  21. 06 8月, 2017 1 次提交
  22. 05 8月, 2017 1 次提交
  23. 03 8月, 2017 4 次提交
  24. 02 8月, 2017 3 次提交
  25. 01 8月, 2017 1 次提交