propshaft 0.1.2 → 0.1.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4916558d76e8ddba23bdf10ae312e22ed3c819a6e8a29dbee96f5de1af5c4d1c
4
- data.tar.gz: 1a463043b2d214683b39646eabe9041d927634cbed03eb723368574100fa3bb9
3
+ metadata.gz: 5a482b12e3d939c6286f02d4e6ca66a141b9124527503f64ceb262277366fca6
4
+ data.tar.gz: a0d5ad9626de08fbab61cf450d95abab5ea77a1e5b90a162cbdc79ee1e424e07
5
5
  SHA512:
6
- metadata.gz: b57b13ef013c61ac2059c853bd40eb3c24a0eb1391425d4d71bcc359e3cc63abfd892455ece2be410c00d61ed2c84b255ea83aaace5edad3a9876d6b3f4cfda7
7
- data.tar.gz: 70c066315e322d9429ff51581796c94f21983ec2816ce8bd90dcbf6c1bfe401ae25670b14198194cb0e3b585e8a4817b853f8984f7e7e26db617b225de797c56
6
+ metadata.gz: 3e60fdc05df54c428a898d460f2df85bdaf1d65a39c4a1025e8e70b758b10e1f39453ee7665c052c6d4b090257cac0b34accb896a25f7362dade2e0fc06b5276
7
+ data.tar.gz: d501ae6047c543b522f791d23d8cd6856a0d3c9101c5cbf3fdb3d632a942fa995dc0707c6bdc872040efb8c63d859ace32be66a93b51788f57aa452ce0930850
data/README.md CHANGED
@@ -1,8 +1,8 @@
1
1
  # Propshaft
2
2
 
3
- Propshaft is an asset pipeline library for Rails. It's built for era where bundling assets to save on HTTP connections is no longer urgent, where JavaScript and CSS is either compiled by dedicated Node.js bundlers or served directly to the browsers, and where increases in bandwidth has made the need for minification less pressing. These factors allow for a dramatically simpler and faster asset pipeline compared to previous options, like Sprockets.
3
+ Propshaft is an asset pipeline library for Rails. It's built for an era where bundling assets to save on HTTP connections is no longer urgent, where JavaScript and CSS are either compiled by dedicated Node.js bundlers or served directly to the browsers, and where increases in bandwidth have made the need for minification less pressing. These factors allow for a dramatically simpler and faster asset pipeline compared to previous options, like Sprockets.
4
4
 
5
- So that's what Propshaft doesn't do. Here's what it actually does provide:
5
+ So that's what Propshaft doesn't do. Here's what it does provide:
6
6
 
7
7
  1. **Configurable load path**: You can register directories from multiple places in your app and gems, and reference assets from all of these paths as though they were one.
8
8
  1. **Digest stamping**: All assets in the load path will be copied (or compiled) in a precompilation step for production that also stamps all of them with a digest hash, so you can use long-expiry cache headers for better performance. The digested assets can be referred to through their logical path because the processing leaves a manifest file that provides a way to translate.
@@ -17,16 +17,16 @@ With Rails 7+, you can start a new application with propshaft using `rails new m
17
17
 
18
18
  ## Usage
19
19
 
20
- Propshaft makes all the assets from all the paths its been configured with through `config.assets.paths` available for serving and will copy all of them into `public/assets` when precompiling. This is unlike Sprockets, which did not copy over assets that hadn't been explicitly included in one of bundled assets.
20
+ Propshaft makes all the assets from all the paths it's been configured with through `config.assets.paths` available for serving and will copy all of them into `public/assets` when precompiling. This is unlike Sprockets, which did not copy over assets that hadn't been explicitly included in one of the bundled assets.
21
21
 
22
- These assets can be referenced through their logical path using the normal helpers like `asset_path`, `image_tag`, `javascript_include_tag`, and all the other asset helper tags. These logical references are automatically converted into digest-aware paths in production when `assets:precompile` has been run (through a json mapping file found in `public/assets/.manifest.json`).
22
+ These assets can be referenced through their logical path using the normal helpers like `asset_path`, `image_tag`, `javascript_include_tag`, and all the other asset helper tags. These logical references are automatically converted into digest-aware paths in production when `assets:precompile` has been run (through a JSON mapping file found in `public/assets/.manifest.json`).
23
23
 
24
24
  Additionally, Propshaft ships with a CSS function called `asset-path("image.svg")` that'll be compiled into `url("/assets/image-f2e1ec14d6856e1958083094170ca6119c529a73.svg")` when doing `assets:precompile`. This function is applied to all `.css` files.
25
25
 
26
26
 
27
27
  ## Migrating from Sprockets
28
28
 
29
- Propshaft does a lot less than Sprockets, by design, so it might well be a fair bit of work to migrate, if it's even desirable. This is particularly true if you rely on Sprockets to provide any form of transpiling, like CoffeeScript or Sass, or if you rely on any gems that do. You'll need to either stop transpiling or use a Node-based transpiler, like those in `jsbundling-rails` and `cssbundling-rails`.
29
+ Propshaft does a lot less than Sprockets, by design, so it might well be a fair bit of work to migrate if it's even desirable. This is particularly true if you rely on Sprockets to provide any form of transpiling, like CoffeeScript or Sass, or if you rely on any gems that do. You'll need to either stop transpiling or use a Node-based transpiler, like those in `jsbundling-rails` and `cssbundling-rails`.
30
30
 
31
31
  On the other hand, if you're already bundling JavaScript and CSS through a Node-based setup, then Propshaft is going to slot in easily. Since you don't need another tool to bundle or transpile. Just to digest and serve.
32
32
 
@@ -33,9 +33,8 @@ class Propshaft::LoadPath
33
33
  paths.each do |path|
34
34
  all_files_from_tree(path).each do |file|
35
35
  logical_path = file.relative_path_from(path)
36
-
37
36
  mapped[logical_path.to_s] ||= Propshaft::Asset.new(file, logical_path: logical_path)
38
- end
37
+ end if path.exist?
39
38
  end
40
39
  end
41
40
  end
@@ -1,6 +1,6 @@
1
1
  class Propshaft::Processor
2
2
  MANIFEST_FILENAME = ".manifest.json"
3
- COMPRESSABLE_CONTENT_TYPES = [ Mime[:js], Mime[:css], Mime[:text], Mime[:svg] ]
3
+ COMPRESSABLE_CONTENT_TYPES = %i[ js css text json xml html svg otf ttf ].collect { |t| Mime[t] }
4
4
 
5
5
  attr_reader :load_path, :output_path, :compilers
6
6
 
@@ -4,7 +4,7 @@ require "active_support/ordered_options"
4
4
 
5
5
  # FIXME: There's gotta be a better way than this hack?
6
6
  class Rails::Engine < Rails::Railtie
7
- initializer :append_assets_path, group: :all do |app|
7
+ initializer "propshaft.append_assets_path", group: :all do |app|
8
8
  app.config.assets.paths.unshift(*paths["vendor/assets"].existent_directories)
9
9
  app.config.assets.paths.unshift(*paths["lib/assets"].existent_directories)
10
10
  app.config.assets.paths.unshift(*paths["app/assets"].existent_directories)
@@ -1,3 +1,3 @@
1
1
  module Propshaft
2
- VERSION = "0.1.2"
2
+ VERSION = "0.1.6"
3
3
  end
data/lib/propshaft.rb CHANGED
@@ -1,3 +1,6 @@
1
+ module Propshaft
2
+ end
3
+
1
4
  require "propshaft/assembly"
2
5
  require "propshaft/helper"
3
6
  require "propshaft/railtie"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: propshaft
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Heinemeier Hansson
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-09-21 00:00:00.000000000 Z
11
+ date: 2021-09-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails