bridgetown-core 0.21.0.beta2 → 0.21.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (66) hide show
  1. checksums.yaml +4 -4
  2. data/bridgetown-core.gemspec +0 -1
  3. data/lib/bridgetown-core.rb +16 -15
  4. data/lib/bridgetown-core/cleaner.rb +2 -2
  5. data/lib/bridgetown-core/collection.rb +13 -8
  6. data/lib/bridgetown-core/commands/concerns/build_options.rb +2 -2
  7. data/lib/bridgetown-core/commands/concerns/git_helpers.rb +20 -0
  8. data/lib/bridgetown-core/commands/configure.rb +4 -3
  9. data/lib/bridgetown-core/commands/new.rb +6 -6
  10. data/lib/bridgetown-core/commands/plugins.rb +14 -13
  11. data/lib/bridgetown-core/commands/serve.rb +1 -1
  12. data/lib/bridgetown-core/commands/webpack.rb +82 -0
  13. data/lib/bridgetown-core/commands/webpack/enable-postcss.rb +12 -0
  14. data/lib/bridgetown-core/commands/webpack/setup.rb +4 -0
  15. data/lib/bridgetown-core/commands/webpack/update.rb +24 -0
  16. data/lib/bridgetown-core/commands/webpack/webpack.config.js +31 -0
  17. data/lib/bridgetown-core/commands/webpack/webpack.defaults.js.erb +130 -0
  18. data/lib/bridgetown-core/component.rb +36 -31
  19. data/lib/bridgetown-core/concerns/front_matter_importer.rb +2 -2
  20. data/lib/bridgetown-core/concerns/layout_placeable.rb +1 -1
  21. data/lib/bridgetown-core/concerns/site/configurable.rb +18 -7
  22. data/lib/bridgetown-core/concerns/site/localizable.rb +3 -5
  23. data/lib/bridgetown-core/concerns/site/processable.rb +5 -4
  24. data/lib/bridgetown-core/concerns/validatable.rb +1 -1
  25. data/lib/bridgetown-core/configuration.rb +12 -5
  26. data/lib/bridgetown-core/configurations/bt-postcss.rb +6 -6
  27. data/lib/bridgetown-core/configurations/netlify.rb +1 -0
  28. data/lib/bridgetown-core/configurations/tailwindcss.rb +14 -9
  29. data/lib/bridgetown-core/configurations/tailwindcss/postcss.config.js +2 -2
  30. data/lib/bridgetown-core/converters/erb_templates.rb +1 -1
  31. data/lib/bridgetown-core/converters/liquid_templates.rb +1 -1
  32. data/lib/bridgetown-core/core_ext/psych.rb +19 -0
  33. data/lib/bridgetown-core/document.rb +2 -2
  34. data/lib/bridgetown-core/drops/resource_drop.rb +2 -1
  35. data/lib/bridgetown-core/drops/site_drop.rb +2 -0
  36. data/lib/bridgetown-core/entry_filter.rb +5 -3
  37. data/lib/bridgetown-core/filters/url_filters.rb +4 -8
  38. data/lib/bridgetown-core/frontmatter_defaults.rb +1 -1
  39. data/lib/bridgetown-core/generators/prototype_generator.rb +25 -4
  40. data/lib/bridgetown-core/layout.rb +27 -10
  41. data/lib/bridgetown-core/model/repo_origin.rb +1 -1
  42. data/lib/bridgetown-core/publisher.rb +2 -2
  43. data/lib/bridgetown-core/reader.rb +1 -1
  44. data/lib/bridgetown-core/readers/data_reader.rb +1 -1
  45. data/lib/bridgetown-core/readers/defaults_reader.rb +1 -1
  46. data/lib/bridgetown-core/readers/layout_reader.rb +1 -1
  47. data/lib/bridgetown-core/regenerator.rb +1 -1
  48. data/lib/bridgetown-core/related_posts.rb +5 -2
  49. data/lib/bridgetown-core/resource/base.rb +29 -7
  50. data/lib/bridgetown-core/resource/destination.rb +3 -1
  51. data/lib/bridgetown-core/resource/permalink_processor.rb +7 -3
  52. data/lib/bridgetown-core/resource/transformer.rb +4 -2
  53. data/lib/bridgetown-core/site.rb +4 -5
  54. data/lib/bridgetown-core/static_file.rb +3 -2
  55. data/lib/bridgetown-core/tags/highlight.rb +2 -15
  56. data/lib/bridgetown-core/utils.rb +1 -1
  57. data/lib/bridgetown-core/version.rb +1 -1
  58. data/lib/bridgetown-core/watcher.rb +1 -0
  59. data/lib/bridgetown-core/yaml_parser.rb +22 -0
  60. data/lib/site_template/bridgetown.config.yml +5 -1
  61. data/lib/site_template/config/.keep +0 -0
  62. data/lib/site_template/package.json.erb +8 -11
  63. data/lib/site_template/plugins/site_builder.rb +1 -1
  64. data/lib/site_template/src/_data/site_metadata.yml +1 -1
  65. metadata +12 -17
  66. data/lib/site_template/webpack.config.js.erb +0 -122
@@ -1,6 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Bridgetown
4
+ # TODO: to be retired once the Resource engine is made official
4
5
  class RelatedPosts
5
6
  class << self
6
7
  attr_accessor :lsi
@@ -11,13 +12,15 @@ module Bridgetown
11
12
  def initialize(post)
12
13
  @post = post
13
14
  @site = post.site
14
- Bridgetown::Utils::RequireGems.require_with_graceful_fail("classifier-reborn") if site.lsi
15
+ if site.config.lsi
16
+ Bridgetown::Utils::RequireGems.require_with_graceful_fail("classifier-reborn")
17
+ end
15
18
  end
16
19
 
17
20
  def build
18
21
  return [] unless site.collections.posts.docs.size > 1
19
22
 
20
- if site.lsi
23
+ if site.config.lsi
21
24
  build_index
22
25
  lsi_related_posts
23
26
  else
@@ -42,6 +42,22 @@ module Bridgetown
42
42
  model.collection
43
43
  end
44
44
 
45
+ # Layout associated with this resource
46
+ # This will output a warning if the layout can't be found.
47
+ #
48
+ # @return [Bridgetown::Layout]
49
+ def layout
50
+ return @layout if @layout
51
+ return if no_layout?
52
+
53
+ @layout = site.layouts[data.layout].tap do |layout|
54
+ unless layout
55
+ Bridgetown.logger.warn "Resource:", "Layout '#{data.layout}' " \
56
+ "requested via #{relative_path} does not exist."
57
+ end
58
+ end
59
+ end
60
+
45
61
  # The relative path of source file or file-like origin
46
62
  #
47
63
  # @return [Pathname]
@@ -98,7 +114,7 @@ module Bridgetown
98
114
  alias_method :read, :read! # TODO: eventually use the bang version only
99
115
 
100
116
  def transform!
101
- transformer.process! if output_allowed?
117
+ transformer.process! unless collection.data?
102
118
  end
103
119
 
104
120
  def trigger_hooks(hook_name, *args)
@@ -165,6 +181,16 @@ module Bridgetown
165
181
  data["date"] ||= site.time
166
182
  end
167
183
 
184
+ # Ask the configured summary extension to output a summary of the content,
185
+ # otherwise return the first line.
186
+ #
187
+ # @return [String]
188
+ def summary
189
+ return summary_extension_output if respond_to?(:summary_extension_output)
190
+
191
+ content.to_s.strip.lines.first.to_s.strip
192
+ end
193
+
168
194
  # @return [Hash<String, Hash<String => Bridgetown::Resource::TaxonomyType,
169
195
  # Array<Bridgetown::Resource::TaxonomyTerm>>>]
170
196
  def taxonomies
@@ -178,12 +204,8 @@ module Bridgetown
178
204
  end
179
205
  end
180
206
 
181
- def output_allowed?
182
- !collection.data? && data.config&.output != false
183
- end
184
-
185
207
  def requires_destination?
186
- collection.write? && output_allowed?
208
+ collection.write? && data.config&.output != false
187
209
  end
188
210
 
189
211
  def write?
@@ -262,7 +284,7 @@ module Bridgetown
262
284
  alias_method :next_doc, :next_resource
263
285
 
264
286
  def previous_resource
265
- pos = collection.docs.index { |item| item.equal?(self) }
287
+ pos = collection.resources.index { |item| item.equal?(self) }
266
288
  collection.resources[pos - 1] if pos&.positive?
267
289
  end
268
290
  alias_method :previous_doc, :previous_resource
@@ -32,7 +32,9 @@ module Bridgetown
32
32
 
33
33
  def output_path
34
34
  path = URL.unescape_path(relative_url)
35
- path = path.delete_prefix(resource.site.baseurl) if resource.site.baseurl.present?
35
+ if resource.site.base_path.present?
36
+ path = path.delete_prefix resource.site.base_path(strip_slash_only: true)
37
+ end
36
38
  path = resource.site.in_dest_dir(path)
37
39
  path = File.join(path, "index.html") if relative_url.end_with? "/"
38
40
  path
@@ -40,7 +40,7 @@ module Bridgetown
40
40
  # No relative URLs should ever end in /index.html
41
41
  new_url.sub!(%r{/index$}, "") if final_ext == ".html"
42
42
 
43
- add_baseurl finalize_permalink(new_url, permalink)
43
+ add_base_path finalize_permalink(new_url, permalink)
44
44
  end
45
45
 
46
46
  def process_segment(segment)
@@ -96,8 +96,12 @@ module Bridgetown
96
96
  end
97
97
  end
98
98
 
99
- def add_baseurl(permalink)
100
- resource.site.baseurl.present? ? "#{resource.site.baseurl}#{permalink}" : permalink
99
+ def add_base_path(permalink)
100
+ if resource.site.base_path.present?
101
+ return "#{resource.site.base_path(strip_slash_only: true)}#{permalink}"
102
+ end
103
+
104
+ permalink
101
105
  end
102
106
 
103
107
  ### Default Placeholders Processors
@@ -15,6 +15,7 @@ module Bridgetown
15
15
  def initialize(resource)
16
16
  @resource = resource
17
17
  @site = resource.site
18
+ @conversions = []
18
19
  end
19
20
 
20
21
  # @return [String]
@@ -110,7 +111,7 @@ module Bridgetown
110
111
 
111
112
  ### Transformation Actions
112
113
 
113
- def run_conversions # rubocop:disable Metrics/AbcSize
114
+ def run_conversions # rubocop:disable Metrics/AbcSize, Metrics/MethodLength
114
115
  input = resource.content.to_s
115
116
 
116
117
  # @param content [String]
@@ -125,7 +126,8 @@ module Bridgetown
125
126
  type: :content,
126
127
  converter: converter,
127
128
  output: Bridgetown.env.production? ? nil : output,
128
- output_ext: conversions[index][:output_ext],
129
+ output_ext: conversions[index]&.dig(:output_ext) ||
130
+ converter.output_ext(resource.extname),
129
131
  }
130
132
  output.html_safe
131
133
  rescue StandardError => e
@@ -30,12 +30,11 @@ module Bridgetown
30
30
  # is default
31
31
  alias_method :generated_pages, :pages
32
32
 
33
- attr_accessor :exclude, :include, :lsi, :highlighter, :permalink_style,
34
- :time, :future, :unpublished, :limit_posts,
35
- :keep_files, :baseurl, :data, :file_read_opts,
36
- :plugin_manager, :converters, :generators, :reader
33
+ attr_accessor :permalink_style, :time, :data,
34
+ :file_read_opts, :plugin_manager, :converters,
35
+ :generators, :reader
37
36
 
38
- # Public: Initialize a new Site.
37
+ # Initialize a new Site.
39
38
  #
40
39
  # config - A Hash containing site configuration details.
41
40
  def initialize(config)
@@ -58,8 +58,9 @@ module Bridgetown
58
58
  def destination(dest)
59
59
  dest = site.in_dest_dir(dest)
60
60
  dest_url = url
61
- dest_url = dest_url.delete_prefix(site.baseurl) if site.uses_resource? &&
62
- site.baseurl.present? && collection
61
+ if site.uses_resource? && site.base_path.present? && collection
62
+ dest_url = dest_url.delete_prefix site.base_path(strip_slash_only: true)
63
+ end
63
64
  site.in_dest_dir(dest, Bridgetown::URL.unescape_path(dest_url))
64
65
  end
65
66
 
@@ -36,13 +36,11 @@ module Bridgetown
36
36
  code = super.to_s.gsub(LEADING_OR_TRAILING_LINE_TERMINATORS, "")
37
37
 
38
38
  output =
39
- case context.registers[:site].highlighter
39
+ case context.registers[:site].config.highlighter
40
40
  when "rouge"
41
41
  render_rouge(code)
42
- when "pygments"
43
- render_pygments(code, context)
44
42
  else
45
- render_codehighlighter(code)
43
+ h(code).strip
46
44
  end
47
45
 
48
46
  rendered_output = add_code_tag(output)
@@ -72,13 +70,6 @@ module Bridgetown
72
70
  options
73
71
  end
74
72
 
75
- def render_pygments(code, _context)
76
- Bridgetown.logger.warn "Warning:", "Highlight Tag no longer supports" \
77
- " rendering with Pygments."
78
- Bridgetown.logger.warn "", "Using the default highlighter, Rouge, instead."
79
- render_rouge(code)
80
- end
81
-
82
73
  def render_rouge(code)
83
74
  require "rouge"
84
75
  formatter = ::Rouge::Formatters::HTMLLegacy.new(
@@ -92,10 +83,6 @@ module Bridgetown
92
83
  formatter.format(lexer.lex(code))
93
84
  end
94
85
 
95
- def render_codehighlighter(code)
96
- h(code).strip
97
- end
98
-
99
86
  def add_code_tag(code)
100
87
  code_attributes = [
101
88
  "class=\"language-#{@lang.to_s.tr("+", "-")}\"",
@@ -380,7 +380,7 @@ module Bridgetown
380
380
 
381
381
  def static_frontend_path(site, additional_parts = [])
382
382
  path_parts = [
383
- site.config["baseurl"].to_s.gsub(%r(^/|/$), ""),
383
+ site.base_path.gsub(%r(^/|/$), ""),
384
384
  "_bridgetown/static",
385
385
  *additional_parts,
386
386
  ]
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Bridgetown
4
- VERSION = "0.21.0.beta2"
4
+ VERSION = "0.21.1"
5
5
  CODE_NAME = "Broughton Beach"
6
6
  end
@@ -127,6 +127,7 @@ module Bridgetown
127
127
 
128
128
  def process(site, time, options)
129
129
  begin
130
+ I18n.reload! # make sure any locale files get read again
130
131
  Bridgetown::Hooks.trigger :site, :pre_reload, site
131
132
  Bridgetown::Hooks.clear_reloadable_hooks
132
133
  site.plugin_manager.reload_plugin_files
@@ -0,0 +1,22 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Bridgetown
4
+ class YAMLParser
5
+ PERMITTED_CLASSES = [Date, Time, Rb].freeze
6
+
7
+ class << self
8
+ def load_file(filename, **kwargs)
9
+ kwargs = { permitted_classes: PERMITTED_CLASSES }.merge(kwargs)
10
+ YAML.safe_load_file(filename, **kwargs)
11
+ end
12
+
13
+ def load(yaml)
14
+ if RUBY_VERSION.start_with?("2.5")
15
+ YAML.safe_load yaml, PERMITTED_CLASSES
16
+ else
17
+ YAML.safe_load yaml, permitted_classes: PERMITTED_CLASSES
18
+ end
19
+ end
20
+ end
21
+ end
22
+ end
@@ -15,9 +15,13 @@
15
15
  # https://learnxinyminutes.com/docs/yaml/
16
16
  #
17
17
 
18
- baseurl: "" # OPTIONAL: the subpath of your site, e.g. /blog
19
18
  url: "" # the base hostname & protocol for your site, e.g. https://example.com
20
19
 
21
20
  permalink: pretty
22
21
 
22
+ # Other options you might want to investigate:
23
+ #
24
+ # base_path: "/" # the subpath of your site, e.g. /blog
23
25
  # timezone: America/Los_Angeles
26
+ # pagination:
27
+ # enabled: true
File without changes
@@ -13,28 +13,25 @@
13
13
  "start": "node start.js"
14
14
  },
15
15
  "devDependencies": {
16
- "@babel/core": "^7.9.0",
17
- "@babel/plugin-proposal-class-properties": "^7.8.3",
18
- "@babel/plugin-proposal-decorators": "^7.10.1",
19
- "@babel/plugin-transform-runtime": "^7.9.0",
20
- "@babel/preset-env": "^7.9.0",
21
- "babel-loader": "^8.1.0",
22
16
  "browser-sync": "^2.26.7",
23
17
  "concurrently": "^5.2.0",
24
18
  "css-loader": "^4.3.0",
19
+ "esbuild": "^0.12.7",
20
+ "esbuild-loader": "^2.13.1",
25
21
  "file-loader": "^6.2.0",
26
22
  "mini-css-extract-plugin": "^1.3.1",
27
23
  <% if options["use-postcss"] %>
28
- "postcss": "^8.1.9",
24
+ "postcss": "^8.3.0",
29
25
  "postcss-flexbugs-fixes": "^4.1.0",
30
- "postcss-loader": "^4.1.0",
26
+ "postcss-loader": "^4.3.0",
31
27
  "postcss-preset-env": "^6.7.0",
32
28
  <% else %>
33
29
  "sass": "^1.32.8",
34
30
  "sass-loader": "^8.0.2",
35
31
  <% end %>
36
- "webpack": "^4.44.2",
37
- "webpack-cli": "^3.3.11",
38
- "webpack-manifest-plugin": "^2.1.0"
32
+ "webpack": "^5.39.1",
33
+ "webpack-cli": "^4.7.2",
34
+ "webpack-manifest-plugin": "^3.1.1"
35
+ "webpack-merge": "^5.8.0"
39
36
  }
40
37
  }
@@ -1,4 +1,4 @@
1
1
  class SiteBuilder < Bridgetown::Builder
2
- # write builders which subclass SiteBuilder in plugins/builder
2
+ # write builders which subclass SiteBuilder in plugins/builders
3
3
  end
4
4
 
@@ -7,5 +7,5 @@
7
7
  title: Your awesome title
8
8
  tagline: This site is totally awesome
9
9
  email: your-email@example.com
10
- description: >- # this means to ignore newlines until "baseurl:"
10
+ description: >-
11
11
  Write an awesome description for your new site here. It will appear in your document head meta (for Google search results) and in your feed.xml site description.
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bridgetown-core
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.21.0.beta2
4
+ version: 0.21.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bridgetown Team
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-05-09 00:00:00.000000000 Z
11
+ date: 2021-07-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activemodel
@@ -234,20 +234,6 @@ dependencies:
234
234
  - - "~>"
235
235
  - !ruby/object:Gem::Version
236
236
  version: '3.0'
237
- - !ruby/object:Gem::Dependency
238
- name: safe_yaml
239
- requirement: !ruby/object:Gem::Requirement
240
- requirements:
241
- - - "~>"
242
- - !ruby/object:Gem::Version
243
- version: '1.0'
244
- type: :runtime
245
- prerelease: false
246
- version_requirements: !ruby/object:Gem::Requirement
247
- requirements:
248
- - - "~>"
249
- - !ruby/object:Gem::Version
250
- version: '1.0'
251
237
  - !ruby/object:Gem::Dependency
252
238
  name: terminal-table
253
239
  requirement: !ruby/object:Gem::Requirement
@@ -327,6 +313,7 @@ files:
327
313
  - lib/bridgetown-core/commands/concerns/actions.rb
328
314
  - lib/bridgetown-core/commands/concerns/build_options.rb
329
315
  - lib/bridgetown-core/commands/concerns/configuration_overridable.rb
316
+ - lib/bridgetown-core/commands/concerns/git_helpers.rb
330
317
  - lib/bridgetown-core/commands/concerns/summarizable.rb
331
318
  - lib/bridgetown-core/commands/configure.rb
332
319
  - lib/bridgetown-core/commands/console.rb
@@ -336,6 +323,12 @@ files:
336
323
  - lib/bridgetown-core/commands/registrations.rb
337
324
  - lib/bridgetown-core/commands/serve.rb
338
325
  - lib/bridgetown-core/commands/serve/servlet.rb
326
+ - lib/bridgetown-core/commands/webpack.rb
327
+ - lib/bridgetown-core/commands/webpack/enable-postcss.rb
328
+ - lib/bridgetown-core/commands/webpack/setup.rb
329
+ - lib/bridgetown-core/commands/webpack/update.rb
330
+ - lib/bridgetown-core/commands/webpack/webpack.config.js
331
+ - lib/bridgetown-core/commands/webpack/webpack.defaults.js.erb
339
332
  - lib/bridgetown-core/component.rb
340
333
  - lib/bridgetown-core/concerns/data_accessible.rb
341
334
  - lib/bridgetown-core/concerns/front_matter_importer.rb
@@ -373,6 +366,7 @@ files:
373
366
  - lib/bridgetown-core/converters/markdown/kramdown_parser.rb
374
367
  - lib/bridgetown-core/converters/ruby_templates.rb
375
368
  - lib/bridgetown-core/converters/smartypants.rb
369
+ - lib/bridgetown-core/core_ext/psych.rb
376
370
  - lib/bridgetown-core/current.rb
377
371
  - lib/bridgetown-core/deprecator.rb
378
372
  - lib/bridgetown-core/document.rb
@@ -457,10 +451,12 @@ files:
457
451
  - lib/bridgetown-core/utils/ruby_front_matter.rb
458
452
  - lib/bridgetown-core/version.rb
459
453
  - lib/bridgetown-core/watcher.rb
454
+ - lib/bridgetown-core/yaml_parser.rb
460
455
  - lib/site_template/.gitignore
461
456
  - lib/site_template/Gemfile.erb
462
457
  - lib/site_template/README.md
463
458
  - lib/site_template/bridgetown.config.yml
459
+ - lib/site_template/config/.keep
464
460
  - lib/site_template/frontend/javascript/index.js.erb
465
461
  - lib/site_template/frontend/styles/index.css
466
462
  - lib/site_template/frontend/styles/index.scss
@@ -485,7 +481,6 @@ files:
485
481
  - lib/site_template/src/posts.md
486
482
  - lib/site_template/start.js
487
483
  - lib/site_template/sync.js
488
- - lib/site_template/webpack.config.js.erb
489
484
  homepage: https://www.bridgetownrb.com
490
485
  licenses:
491
486
  - MIT
@@ -1,122 +0,0 @@
1
- const path = require("path");
2
- const MiniCssExtractPlugin = require("mini-css-extract-plugin");
3
- const ManifestPlugin = require("webpack-manifest-plugin");
4
-
5
- module.exports = {
6
- entry: {
7
- main: "./frontend/javascript/index.js"
8
- },
9
- devtool: "source-map",
10
- // Set some or all of these to true if you want more verbose logging:
11
- stats: {
12
- modules: false,
13
- builtAt: false,
14
- timings: false,
15
- children: false,
16
- },
17
- output: {
18
- path: path.resolve(__dirname, "output", "_bridgetown", "static", "js"),
19
- filename: "[name].[contenthash].js",
20
- },
21
- resolve: {
22
- extensions: [".js", ".jsx"],
23
- modules: [
24
- path.resolve(__dirname, 'frontend', 'javascript'),
25
- path.resolve(__dirname, 'frontend', 'styles'),
26
- path.resolve('./node_modules')
27
- ],
28
- alias: {
29
- bridgetownComponents: path.resolve(__dirname, "src", "_components")
30
- }
31
- },
32
- plugins: [
33
- new MiniCssExtractPlugin({
34
- filename: "../css/[name].[contenthash].css",
35
- }),
36
- new ManifestPlugin({
37
- fileName: path.resolve(__dirname, ".bridgetown-webpack", "manifest.json"),
38
- }),
39
- ],
40
- module: {
41
- rules: [
42
- {
43
- test: /\.(js|jsx)/,
44
- use: {
45
- loader: "babel-loader",
46
- options: {
47
- presets: ["@babel/preset-env"],
48
- plugins: [
49
- ["@babel/plugin-proposal-decorators", { "legacy": true }],
50
- ["@babel/plugin-proposal-class-properties", { "loose" : true }],
51
- [
52
- "@babel/plugin-transform-runtime",
53
- {
54
- helpers: false,
55
- },
56
- ],
57
- ],
58
- },
59
- },
60
- },
61
- <% if options["use-postcss"] %>
62
- {
63
- test: /\.(s[ac]|c)ss$/,
64
- use: [
65
- MiniCssExtractPlugin.loader,
66
- {
67
- loader: "css-loader",
68
- options: {
69
- url: url => !url.startsWith('/'),
70
- importLoaders: 1
71
- }
72
- },
73
- "postcss-loader"
74
- ],
75
- },
76
- <% else %>
77
- {
78
- test: /\.(s[ac]|c)ss$/,
79
- use: [
80
- MiniCssExtractPlugin.loader,
81
- {
82
- loader: "css-loader",
83
- options: {
84
- url: url => !url.startsWith('/')
85
- }
86
- },
87
- {
88
- loader: "sass-loader",
89
- options: {
90
- implementation: require("sass"),
91
- sassOptions: {
92
- fiber: false,
93
- includePaths: [
94
- path.resolve(__dirname, "src/_components")
95
- ],
96
- },
97
- },
98
- },
99
- ],
100
- },
101
- <% end %>
102
- {
103
- test: /\.woff2?$|\.ttf$|\.eot$/,
104
- loader: "file-loader",
105
- options: {
106
- name: "[name]-[contenthash].[ext]",
107
- outputPath: "../fonts",
108
- publicPath: "../fonts",
109
- },
110
- },
111
- {
112
- test: /\.png?$|\.gif$|\.jpg$|\.svg$/,
113
- loader: "file-loader",
114
- options: {
115
- name: "[path][name]-[contenthash].[ext]",
116
- outputPath: "../",
117
- publicPath: "../",
118
- },
119
- },
120
- ],
121
- },
122
- };