bridgetown-core 0.18.6 → 0.19.0

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: fad1c759bc15d188091ea79b5da7beee2b1b2f41c0bdac3d6196b4066a376379
4
- data.tar.gz: 9dc54e1b1f2563bfeaf3e9cbb51cc0ca48bbf2f713aa030d027a34d3c7388b0f
3
+ metadata.gz: 5a0a5aeb69553f660c93b0f0a4026696fb075fbbaee350dab4591d43efc2268d
4
+ data.tar.gz: 97a706bb02102be600a8b5462612249c2ee4cf366ee5f994b70c6047f7746c00
5
5
  SHA512:
6
- metadata.gz: 3c7ff76d444621a53ec11a7cb47df4a84012aea31318b821ab2446add1eb187ce306c0623fa55cb8c790a35817da0e73c4eb69cd8caed979c3acbcdb295ce866
7
- data.tar.gz: 89708630ae7ced2085ba9577cd23d2d434230d79410eaeabc396483b86c041bbac78bec7fdb0ffb6ff45ff886e69dd4a9ca13d0719c04be96397288498b0d5e0
6
+ metadata.gz: bb0ce9658edcf29ecd07cab05c0b3dd97cac66d710d7447257e16ce1df584d9257cd4cb9d0aaadac54a829918084ef00c90540d0b97d3437d4467719b8052130
7
+ data.tar.gz: d051bf13d11a911562854c3190a206c0a6b2b6c824be1ecf2786dde0766eb25b1fef8d0910b13795a574d2945bacbe175f818d85e68b52676788639285eec778
@@ -52,4 +52,5 @@ Gem::Specification.new do |s|
52
52
  s.add_runtime_dependency("terminal-table", "~> 1.8")
53
53
  s.add_runtime_dependency("thor", "~> 1.0")
54
54
  s.add_runtime_dependency("tilt", "~> 2.0")
55
+ s.add_runtime_dependency("webrick", "~> 1.7")
55
56
  end
@@ -29,8 +29,12 @@ require "csv"
29
29
  require "json"
30
30
 
31
31
  # 3rd party
32
+ require "active_support"
33
+ require "active_support/core_ext/hash/keys"
32
34
  require "active_support/core_ext/object/blank"
33
35
  require "active_support/core_ext/string/inflections"
36
+ require "active_support/core_ext/string/inquiry"
37
+ require "active_support/core_ext/string/starts_ends_with"
34
38
  require "hash_with_dot_access"
35
39
  require "pathutil"
36
40
  require "addressable/uri"
@@ -58,6 +62,16 @@ SafeYAML::OPTIONS[:suppress_warnings] = true
58
62
  class Rb < String; end
59
63
  SafeYAML::OPTIONS[:whitelisted_tags] = ["!ruby/string:Rb"]
60
64
 
65
+ if RUBY_VERSION.start_with?("3.0")
66
+ # workaround for Ruby 3 preview 2, maybe can remove later
67
+ # rubocop:disable Style/GlobalVars
68
+ old_verbose = $VERBOSE
69
+ $VERBOSE = nil
70
+ SafeYAML::SafeToRubyVisitor.const_set(:INITIALIZE_ARITY, 2)
71
+ $verbose = old_verbose
72
+ # rubocop:enable Style/GlobalVars
73
+ end
74
+
61
75
  module Bridgetown
62
76
  # internal requires
63
77
  autoload :Cleaner, "bridgetown-core/cleaner"
@@ -126,7 +140,7 @@ module Bridgetown
126
140
  # Tells you which Bridgetown environment you are building in so
127
141
  # you can skip tasks if you need to.
128
142
  def environment
129
- ENV["BRIDGETOWN_ENV"] || "development"
143
+ (ENV["BRIDGETOWN_ENV"] || "development").inquiry
130
144
  end
131
145
  alias_method :env, :environment
132
146
 
@@ -28,6 +28,9 @@ module Bridgetown
28
28
  class_option :"skip-yarn",
29
29
  type: :boolean,
30
30
  desc: "Skip 'yarn install'"
31
+ class_option :"use-postcss",
32
+ type: :boolean,
33
+ desc: "Create an empty PostCSS configuration instead of using Sass"
31
34
 
32
35
  DOCSURL = "https://bridgetownrb.com/docs"
33
36
 
@@ -47,6 +50,8 @@ module Bridgetown
47
50
  raise ArgumentError, "You must specify a path." if args.empty?
48
51
 
49
52
  new_site_path = File.expand_path(args.join(" "), Dir.pwd)
53
+ @site_name = new_site_path.split(File::SEPARATOR).last
54
+
50
55
  if preserve_source_location?(new_site_path, options)
51
56
  say_status :conflict, "#{new_site_path} exists and is not empty.", :red
52
57
  Bridgetown.logger.abort_with "Ensure #{new_site_path} is empty or else " \
@@ -67,7 +72,7 @@ module Bridgetown
67
72
  end
68
73
 
69
74
  def create_site(new_site_path)
70
- directory ".", ".", exclude_pattern: %r!\.erb|DS_Store$!
75
+ directory ".", ".", exclude_pattern: %r!\.erb|DS_Store$|\.(s[ac]|c)ss$!
71
76
  FileUtils.chmod_R "u+w", new_site_path
72
77
 
73
78
  template(
@@ -75,6 +80,20 @@ module Bridgetown
75
80
  "src/_posts/#{Time.now.strftime("%Y-%m-%d")}-welcome-to-bridgetown.md"
76
81
  )
77
82
  template("Gemfile.erb", "Gemfile")
83
+ template("package.json.erb", "package.json")
84
+ template("webpack.config.js.erb", "webpack.config.js")
85
+ template("frontend/javascript/index.js.erb", "frontend/javascript/index.js")
86
+
87
+ options["use-postcss"] ? configure_postcss : configure_sass
88
+ end
89
+
90
+ def configure_sass
91
+ copy_file("frontend/styles/index.scss")
92
+ end
93
+
94
+ def configure_postcss
95
+ template("postcss.config.js.erb", "postcss.config.js")
96
+ copy_file("frontend/styles/index.css")
78
97
  end
79
98
 
80
99
  # After a new site has been created, print a success notification and
@@ -126,7 +126,7 @@ module Bridgetown
126
126
  # @return [String] a link unreadable for bots but will be recovered on focus or mouseover
127
127
  def obfuscate_link(input, prefix = "mailto")
128
128
  link = "<a href=\"#{prefix}:#{input}\">#{input}</a>"
129
- script = "<script type=\"text/javascript\">document.currentScript.insertAdjacentHTML("
129
+ script = "<script type=\"text/javascript\">document.currentScript.insertAdjacentHTML('"
130
130
  script += "beforebegin', '#{rot47(link).gsub(%r!\\!, '\\\\\\')}'.replace(/[!-~]/g,"
131
131
  script += "function(c){{var j=c.charCodeAt(0);if((j>=33)&&(j<=126)){"
132
132
  script += "return String.fromCharCode(33+((j+ 14)%94));}"
@@ -7,6 +7,9 @@ module Bridgetown
7
7
  # The class instance is basically just a bare-bones entity with just
8
8
  # attributes "dir", "name", "path", "url" defined on it.
9
9
  class PageWithoutAFile < Page
10
+ Bridgetown.logger.warn "NOTICE: the PageWithoutAFile class is deprecated and" \
11
+ " will be removed in Bridgetown 0.20."
12
+
10
13
  def read_yaml(*)
11
14
  @data ||= {}
12
15
  end
@@ -1,7 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require "digest"
4
- require "active_support/core_ext/hash/keys"
5
4
 
6
5
  module Bridgetown
7
6
  class RubyTemplateView
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Bridgetown
4
- VERSION = "0.18.6"
5
- CODE_NAME = "Taylor Street"
4
+ VERSION = "0.19.0"
5
+ CODE_NAME = "Arbor Lodge"
6
6
  end
@@ -0,0 +1,11 @@
1
+ <% if options["use-postcss"] %>
2
+ import "index.css"
3
+ <% else %>
4
+ import "index.scss"
5
+ <% end %>
6
+
7
+ // Import all javascript files from src/_components
8
+ const componentsContext = require.context("bridgetownComponents", true, /.js$/)
9
+ componentsContext.keys().forEach(componentsContext)
10
+
11
+ console.info("Bridgetown is loaded!")
@@ -0,0 +1,19 @@
1
+ :root {
2
+ --body-background: #fafafa;
3
+ --body-color: #444;
4
+ }
5
+
6
+ body {
7
+ background: var(--body-background);
8
+ color: var(--body-color);
9
+ font-family: sans-serif;
10
+ }
11
+
12
+ h1, nav, footer {
13
+ text-align: center;
14
+ }
15
+
16
+ main {
17
+ margin: 4rem auto;
18
+ max-width: 60rem;
19
+ }
@@ -1,5 +1,5 @@
1
1
  {
2
- "name": "new-bridgetown-site",
2
+ "name": "<%= @site_name %>",
3
3
  "version": "1.0.0",
4
4
  "private": true,
5
5
  "scripts": {
@@ -21,14 +21,20 @@
21
21
  "babel-loader": "^8.1.0",
22
22
  "browser-sync": "^2.26.7",
23
23
  "concurrently": "^5.2.0",
24
- "css-loader": "^3.4.2",
25
- "file-loader": "^6.0.0",
26
- "mini-css-extract-plugin": "^0.9.0",
24
+ "css-loader": "^4.3.0",
25
+ "file-loader": "^6.2.0",
26
+ "mini-css-extract-plugin": "^1.3.1",
27
+ <% if options["use-postcss"] %>
28
+ "postcss": "^8.1.9",
29
+ "postcss-flexbugs-fixes": "^4.1.0",
30
+ "postcss-loader": "^4.1.0",
31
+ "postcss-preset-env": "^6.7.0",
32
+ <% else %>
27
33
  "node-sass": "^4.13.1",
28
- "sass-loader": "^8.0.2",
29
- "style-loader": "^1.1.3",
30
- "webpack": "^4.42.1",
34
+ "sass-loader": "^8.0.2",
35
+ <% end %>
36
+ "webpack": "^4.44.2",
31
37
  "webpack-cli": "^3.3.11",
32
- "webpack-manifest-plugin": "^2.2.0"
38
+ "webpack-manifest-plugin": "^2.1.0"
33
39
  }
34
40
  }
@@ -0,0 +1,11 @@
1
+ module.exports = {
2
+ plugins: {
3
+ 'postcss-flexbugs-fixes': {},
4
+ 'postcss-preset-env': {
5
+ autoprefixer: {
6
+ flexbox: 'no-2009'
7
+ },
8
+ stage: 3
9
+ }
10
+ }
11
+ }
@@ -1,3 +1,3 @@
1
1
  <footer>
2
- Contact me at {{ metadata.email }}
2
+ Contact me at <a href="mailto:{{ metadata.email }}">{{ metadata.email }}</a>
3
3
  </footer>
@@ -23,4 +23,4 @@ print_hi('Tom')
23
23
  #=> prints 'Hi, Tom' to STDOUT.
24
24
  ````
25
25
 
26
- Check out the [Bridgetown docs](https://bridgetownrb.com/docs/) for more info on how to get the most out of Bridgetown. File all bugs/feature requests at [Bridgetown’s GitHub repo](https://github.com/bridgetownrb/bridgetown). If you have questions, you can ask them on [Bridgetown Community Forum](https://community.bridgetownrb.com).
26
+ Check out the [Bridgetown docs](https://bridgetownrb.com/docs/) for more info on how to get the most out of Bridgetown. File all bugs/feature requests at [Bridgetown’s GitHub repo](https://github.com/bridgetownrb/bridgetown). If you have questions, you can ask them on [Bridgetown Discussions on GitHub](https://github.com/bridgetownrb/bridgetown/discussions).
@@ -18,6 +18,14 @@ module.exports = {
18
18
  },
19
19
  resolve: {
20
20
  extensions: [".js", ".jsx"],
21
+ modules: [
22
+ path.resolve(__dirname, 'frontend', 'javascript'),
23
+ path.resolve(__dirname, 'frontend', 'styles'),
24
+ path.resolve('./node_modules')
25
+ ],
26
+ alias: {
27
+ bridgetownComponents: path.resolve(__dirname, "src", "_components")
28
+ }
21
29
  },
22
30
  plugins: [
23
31
  new MiniCssExtractPlugin({
@@ -48,6 +56,21 @@ module.exports = {
48
56
  },
49
57
  },
50
58
  },
59
+ <% if options["use-postcss"] %>
60
+ {
61
+ test: /\.(s[ac]|c)ss$/,
62
+ use: [
63
+ MiniCssExtractPlugin.loader,
64
+ {
65
+ loader: "css-loader",
66
+ options: {
67
+ importLoaders: 1
68
+ }
69
+ },
70
+ "postcss-loader"
71
+ ],
72
+ },
73
+ <% else %>
51
74
  {
52
75
  test: /\.(s[ac]|c)ss$/,
53
76
  use: [
@@ -65,6 +88,7 @@ module.exports = {
65
88
  },
66
89
  ],
67
90
  },
91
+ <% end %>
68
92
  {
69
93
  test: /\.woff2?$|\.ttf$|\.eot$|\.svg$/,
70
94
  loader: "file-loader",
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.18.6
4
+ version: 0.19.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bridgetown Team
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-11-12 00:00:00.000000000 Z
11
+ date: 2020-12-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -304,6 +304,20 @@ dependencies:
304
304
  - - "~>"
305
305
  - !ruby/object:Gem::Version
306
306
  version: '2.0'
307
+ - !ruby/object:Gem::Dependency
308
+ name: webrick
309
+ requirement: !ruby/object:Gem::Requirement
310
+ requirements:
311
+ - - "~>"
312
+ - !ruby/object:Gem::Version
313
+ version: '1.7'
314
+ type: :runtime
315
+ prerelease: false
316
+ version_requirements: !ruby/object:Gem::Requirement
317
+ requirements:
318
+ - - "~>"
319
+ - !ruby/object:Gem::Version
320
+ version: '1.7'
307
321
  description: Bridgetown is a Webpack-aware, Ruby-powered static site generator for
308
322
  the modern Jamstack era
309
323
  email: maintainers@bridgetownrb.com
@@ -435,11 +449,13 @@ files:
435
449
  - lib/site_template/.gitignore
436
450
  - lib/site_template/Gemfile.erb
437
451
  - lib/site_template/bridgetown.config.yml
438
- - lib/site_template/frontend/javascript/index.js
452
+ - lib/site_template/frontend/javascript/index.js.erb
453
+ - lib/site_template/frontend/styles/index.css
439
454
  - lib/site_template/frontend/styles/index.scss
440
- - lib/site_template/package.json
455
+ - lib/site_template/package.json.erb
441
456
  - lib/site_template/plugins/builders/.keep
442
457
  - lib/site_template/plugins/site_builder.rb
458
+ - lib/site_template/postcss.config.js.erb
443
459
  - lib/site_template/src/404.html
444
460
  - lib/site_template/src/_components/footer.liquid
445
461
  - lib/site_template/src/_components/head.liquid
@@ -457,7 +473,7 @@ files:
457
473
  - lib/site_template/src/posts.md
458
474
  - lib/site_template/start.js
459
475
  - lib/site_template/sync.js
460
- - lib/site_template/webpack.config.js
476
+ - lib/site_template/webpack.config.js.erb
461
477
  homepage: https://www.bridgetownrb.com
462
478
  licenses:
463
479
  - MIT
@@ -1,3 +0,0 @@
1
- import "../styles/index.scss"
2
-
3
- console.info("Bridgetown is loaded!")