middleman-importmap 0.1.0 → 0.1.1

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: fa6a34d5c0c79ece0369c0dabbc30bf59493a998a9e353a9b6609d5f46797ae8
4
- data.tar.gz: a1dc98ff572e075939f0eefe0707a3e84230bef30d0bcd179946bf5f46468616
3
+ metadata.gz: 0aece5cc6d216ca252737d7f462ed9c08d44a7acda06739eb87a537b0cadc6f8
4
+ data.tar.gz: 72ce4218a1575043adfb4c94ebe8055fb7340e23b5a919bd2489208109f8156e
5
5
  SHA512:
6
- metadata.gz: 67fb7f8e7eb827bc60d497b8a232f5b6f707c7140bf1498c081d568840831d16d7b1ac1a6fffa67f3aae365b7faa868e54689b3bc80848d5f6516da066726c15
7
- data.tar.gz: d0f1899ee1eac2caa92600d4960d5cb85957562fc3649217390df583513bca3a4167b1b009f8cef5c5479e05e9455a5d20149fcf6ba0b158ca72a9f7e1e6cf8f
6
+ metadata.gz: d8d533a6d9c817e396bcd6a5a2c7b7d22055a6bd88d365ef6414aa2c12a4f0663831e7206e169822bc99f834be851abcc9e69a48318f068e69a176f3ffef7943
7
+ data.tar.gz: b4913d16c4152acf17bc4c954ca653ae52b52909e057ce1ec1d8c9e59cbe85b04170bfd548b4c6c3642318ed210fc9f956d68d35507aa9ecae084aef1bf06b2a
@@ -1,7 +1,8 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require "erb"
4
+ require "yaml"
3
5
  require "middleman-core"
4
- require "moddleman-importmap/helpers"
5
6
 
6
7
  module Middleman
7
8
  class ImportmapExtension < Extension
@@ -15,7 +16,33 @@ module Middleman
15
16
  def after_configuration; end
16
17
 
17
18
  helpers do
18
- include ::Middleman::Importmap::Helpers
19
+ def javascript_importmap_tags(entrypoint = "site", shim: true)
20
+ [
21
+ javascript_importmap_shim_tag,
22
+ javascript_inline_importmap_tag,
23
+ javascript_inline_module_tag(entrypoint),
24
+ ].join
25
+ end
26
+
27
+ def javascript_importmap_shim_tag
28
+ template = File.join(File.dirname(__FILE__), "views/javascript_impotmap_shim_tag.html.erb")
29
+ erb = ERB.new(File.read(template))
30
+ erb.result
31
+ end
32
+
33
+ def javascript_inline_importmap_tag(importmap = "importmap.yml")
34
+ template = File.join(File.dirname(__FILE__), "views/javascript_inline_impotmap_tag.html.erb")
35
+ importmap_config = YAML.load_file(File.join(app.root_path, importmap), symbolize_names: true)
36
+
37
+ erb = ERB.new(File.read(template))
38
+ erb.result_with_hash(importmap: importmap_config)
39
+ end
40
+
41
+ def javascript_inline_module_tag(entrypoint)
42
+ template = File.join(File.dirname(__FILE__), "views/javascript_inline_module_tag.html.erb")
43
+ erb = ERB.new(File.read(template))
44
+ erb.result_with_hash(entrypoint: entrypoint)
45
+ end
19
46
  end
20
47
  end
21
48
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Middleman
4
4
  module Importmap
5
- VERSION = "0.1.0"
5
+ VERSION = "0.1.1"
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: middleman-importmap
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Daniel Vinciguerra
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-03-04 00:00:00.000000000 Z
11
+ date: 2022-03-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: middleman-core
@@ -31,21 +31,14 @@ executables: []
31
31
  extensions: []
32
32
  extra_rdoc_files: []
33
33
  files:
34
- - ".gitignore"
35
- - Gemfile
36
- - LICENSE
37
- - README.md
38
- - Rakefile
39
34
  - features/support/env.rb
40
35
  - lib/middleman-importmap.rb
41
36
  - lib/middleman-importmap/extension.rb
42
- - lib/middleman-importmap/helpers.rb
43
37
  - lib/middleman-importmap/version.rb
44
38
  - lib/middleman-importmap/views/javascript_impotmap_shim_tag.html.erb
45
39
  - lib/middleman-importmap/views/javascript_inline_impotmap_tag.html.erb
46
40
  - lib/middleman-importmap/views/javascript_inline_module_tag.html.erb
47
41
  - lib/middleman_extension.rb
48
- - middleman-importmap.gemspec
49
42
  homepage: https://github.com/dvinciguerra/middleman-importmap
50
43
  licenses: []
51
44
  metadata: {}
data/.gitignore DELETED
@@ -1,61 +0,0 @@
1
- *.gem
2
- *.rbc
3
- /.config
4
- /coverage/
5
- /InstalledFiles
6
- /pkg/
7
- /spec/reports/
8
- /spec/examples.txt
9
- /test/tmp/
10
- /test/version_tmp/
11
- /tmp/
12
-
13
- # Used by dotenv library to load environment variables.
14
- # .env
15
-
16
- # Ignore Byebug command history file.
17
- .byebug_history
18
-
19
- ## Specific to RubyMotion:
20
- .dat*
21
- .repl_history
22
- build/
23
- *.bridgesupport
24
- build-iPhoneOS/
25
- build-iPhoneSimulator/
26
-
27
- ## Specific to RubyMotion (use of CocoaPods):
28
- #
29
- # We recommend against adding the Pods directory to your .gitignore. However
30
- # you should judge for yourself, the pros and cons are mentioned at:
31
- # https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control
32
- #
33
- # vendor/Pods/
34
-
35
- ## Documentation cache and generated files:
36
- /.yardoc/
37
- /_yardoc/
38
- /doc/
39
- /rdoc/
40
-
41
- ## Environment normalization:
42
- /.bundle/
43
- /vendor/bundle
44
- /lib/bundler/man/
45
-
46
- # for a library or gem, you might want to ignore these files since the code is
47
- # intended to run in multiple environments; otherwise, check them in:
48
- # Gemfile.lock
49
- # .ruby-version
50
- # .ruby-gemset
51
-
52
- # unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
53
- .rvmrc
54
-
55
- # Used by RuboCop. Remote config files pulled in from inherit_from directive.
56
- # .rubocop-https?--*
57
- # Ignore bundler lock file
58
- /Gemfile.lock
59
-
60
- # Ignore pkg folder
61
- /pkg
data/Gemfile DELETED
@@ -1,18 +0,0 @@
1
- # If you do not have OpenSSL installed, update
2
- # the following line to use "http://" instead
3
- source 'https://rubygems.org'
4
-
5
- # Specify your gem's dependencies in middleman-importmap.gemspec
6
- gemspec
7
-
8
- group :development do
9
- gem 'rake'
10
- gem 'rdoc'
11
- gem 'yard'
12
- end
13
-
14
- group :test do
15
- gem 'cucumber'
16
- gem 'aruba'
17
- gem 'rspec'
18
- end
data/LICENSE DELETED
@@ -1,21 +0,0 @@
1
- MIT License
2
-
3
- Copyright (c) 2022 Daniel Vinciguerra
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
data/README.md DELETED
@@ -1,26 +0,0 @@
1
-
2
- # middleman-importmap
3
-
4
- An Importmap extension for Middleman.
5
-
6
-
7
- ## Install
8
-
9
- **Add gem to `Gemfile`**
10
-
11
- `gem 'middleman-importmap'`
12
-
13
- **Create the `importmap.yml` file at middleman root path**
14
-
15
- `cd middleman_project && touch importmap.yml`
16
-
17
- The importmap.yml file keep the same structure of importmap in HTML
18
-
19
-
20
- ## License
21
-
22
- See `./LICENSE` file for more details.
23
-
24
- ## Author
25
-
26
- Daniel Vinciguerra
data/Rakefile DELETED
@@ -1,16 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require "bundler"
4
- Bundler::GemHelper.install_tasks
5
-
6
- require "cucumber/rake/task"
7
-
8
- Cucumber::Rake::Task.new(:cucumber, "Run features that should pass") do |t|
9
- t.cucumber_opts = "--color --tags not @wip --strict"
10
- end
11
-
12
- require "rake/clean"
13
-
14
- task test: ["cucumber"]
15
-
16
- task default: :test
@@ -1,38 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require "erb"
4
- require "yaml"
5
-
6
- module Middleman
7
- module Importmap
8
- module Helpers
9
- def javascript_importmap_tags(entrypoint = "site", shim: true)
10
- [
11
- javascript_importmap_shim_tag,
12
- javascript_inline_importmap_tag,
13
- javascript_inline_module_tag(entrypoint),
14
- ].join
15
- end
16
-
17
- def javascript_importmap_shim_tag
18
- template = File.join(File.dirname(__FILE__), "views/javascript_impotmap_shim_tag.html.erb")
19
- erb = ERB.new(File.read(template))
20
- erb.result
21
- end
22
-
23
- def javascript_inline_importmap_tag(importmap = "importmap.yml")
24
- template = File.join(File.dirname(__FILE__), "views/javascript_inline_impotmap_tag.html.erb")
25
- importmap_config = YAML.load_file(File.join(app.root_path, importmap), symbolize_names: true)
26
-
27
- erb = ERB.new(File.read(template))
28
- erb.result_with_hash(importmap: importmap_config)
29
- end
30
-
31
- def javascript_inline_module_tag(entrypoint)
32
- template = File.join(File.dirname(__FILE__), "views/javascript_inline_module_tag.html.erb")
33
- erb = ERB.new(File.read(template))
34
- erb.result_with_hash(entrypoint: entrypoint)
35
- end
36
- end
37
- end
38
- end
@@ -1,28 +0,0 @@
1
- # -*- encoding: utf-8 -*-
2
- # frozen_string_literal: true
3
-
4
- $LOAD_PATH.push(File.expand_path("../lib", __FILE__))
5
-
6
- require "middleman-importmap/version"
7
-
8
- Gem::Specification.new do |s|
9
- s.name = "middleman-importmap"
10
- s.version = Middleman::Importmap::VERSION
11
- s.platform = Gem::Platform::RUBY
12
- s.authors = ["Daniel Vinciguerra"]
13
- s.email = ["daniel.vinciguerra@bivee.com.br"]
14
- s.homepage = "https://github.com/dvinciguerra/middleman-importmap"
15
- s.summary = "Middleman Importmap extension"
16
- s.description = "An extension to port importmap assets to Middleman"
17
-
18
- s.files = %x(git ls-files).split("\n")
19
- s.test_files = %x(git ls-files -- {test,spec,features}/*).split("\n")
20
- s.executables = %x(git ls-files -- bin/*).split("\n").map { |f| File.basename(f) }
21
- s.require_paths = ["lib"]
22
-
23
- # The version of middleman-core your extension depends on
24
- s.add_runtime_dependency("middleman-core", [">= 4.4.2"])
25
-
26
- # Additional dependencies
27
- # s.add_runtime_dependency("gem-name", "gem-version")
28
- end