webpacker 5.4.1 → 6.0.0.rc.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (188) hide show
  1. checksums.yaml +4 -4
  2. data/.eslintrc.js +1 -1
  3. data/.github/workflows/jest.yml +5 -2
  4. data/.github/workflows/js-lint.yml +5 -2
  5. data/.github/workflows/rubocop.yml +1 -1
  6. data/.github/workflows/ruby.yml +19 -4
  7. data/.gitignore +2 -0
  8. data/.node-version +1 -1
  9. data/.rubocop.yml +4 -3
  10. data/CHANGELOG.md +24 -6
  11. data/CONTRIBUTING.md +1 -1
  12. data/Gemfile.lock +82 -82
  13. data/README.md +377 -172
  14. data/config/README.md +3 -0
  15. data/config/webpacker.yml +1 -0
  16. data/docs/deployment.md +9 -11
  17. data/docs/developing_webpacker.md +29 -0
  18. data/docs/troubleshooting.md +57 -25
  19. data/docs/v6_upgrade.md +75 -0
  20. data/gemfiles/Gemfile-rails.6.1.x +12 -0
  21. data/lib/install/bin/yarn +18 -0
  22. data/lib/install/config/webpack/base.js +3 -0
  23. data/lib/install/config/webpack/development.js +2 -2
  24. data/lib/install/config/webpack/production.js +2 -2
  25. data/lib/install/config/webpack/test.js +2 -2
  26. data/lib/install/config/webpacker.yml +20 -50
  27. data/lib/install/package.json +17 -0
  28. data/lib/install/{javascript/packs → packs/entrypoints}/application.js +4 -3
  29. data/lib/install/template.rb +54 -28
  30. data/lib/tasks/webpacker/binstubs.rake +6 -4
  31. data/lib/tasks/webpacker/check_binstubs.rake +4 -4
  32. data/lib/tasks/webpacker/check_node.rake +3 -0
  33. data/lib/tasks/webpacker/check_yarn.rake +3 -0
  34. data/lib/tasks/webpacker/clobber.rake +1 -1
  35. data/lib/tasks/webpacker/compile.rake +4 -2
  36. data/lib/tasks/webpacker/info.rake +12 -10
  37. data/lib/tasks/webpacker/install.rake +6 -4
  38. data/lib/tasks/webpacker/verify_config.rake +14 -0
  39. data/lib/tasks/webpacker/verify_install.rake +1 -10
  40. data/lib/tasks/webpacker/yarn_install.rake +9 -7
  41. data/lib/tasks/webpacker.rake +2 -11
  42. data/lib/tasks/yarn.rake +36 -0
  43. data/lib/webpacker/commands.rb +21 -16
  44. data/lib/webpacker/compiler.rb +16 -9
  45. data/lib/webpacker/configuration.rb +8 -32
  46. data/lib/webpacker/dev_server.rb +6 -0
  47. data/lib/webpacker/dev_server_runner.rb +28 -4
  48. data/lib/webpacker/helper.rb +47 -81
  49. data/lib/webpacker/instance.rb +4 -0
  50. data/lib/webpacker/manifest.rb +2 -3
  51. data/lib/webpacker/railtie.rb +1 -2
  52. data/lib/webpacker/runner.rb +1 -1
  53. data/lib/webpacker/version.rb +1 -1
  54. data/lib/webpacker/webpack_runner.rb +6 -0
  55. data/lib/webpacker.rb +1 -1
  56. data/package/__tests__/config.js +5 -37
  57. data/package/__tests__/development.js +14 -15
  58. data/package/__tests__/env.js +16 -4
  59. data/package/__tests__/index.js +9 -0
  60. data/package/__tests__/production.js +6 -6
  61. data/package/__tests__/staging.js +7 -6
  62. data/package/__tests__/test.js +4 -5
  63. data/package/babel/preset.js +54 -0
  64. data/package/config.js +6 -14
  65. data/package/env.js +13 -4
  66. data/package/environments/__tests__/base.js +20 -52
  67. data/package/environments/base.js +68 -128
  68. data/package/environments/development.js +50 -44
  69. data/package/environments/production.js +66 -64
  70. data/package/environments/test.js +2 -2
  71. data/package/index.js +15 -8
  72. data/package/inliningCss.js +7 -0
  73. data/package/rules/babel.js +10 -8
  74. data/package/rules/coffee.js +6 -0
  75. data/package/rules/erb.js +15 -0
  76. data/package/rules/file.js +21 -19
  77. data/package/rules/index.js +16 -18
  78. data/package/rules/less.js +22 -0
  79. data/package/rules/raw.js +5 -0
  80. data/package/rules/sass.js +9 -10
  81. data/package/rules/stylus.js +26 -0
  82. data/package/utils/get_style_rule.js +28 -36
  83. data/package/utils/helpers.js +28 -35
  84. data/package.json +12 -32
  85. data/test/command_test.rb +76 -0
  86. data/test/compiler_test.rb +0 -12
  87. data/test/configuration_test.rb +4 -35
  88. data/test/dev_server_runner_test.rb +36 -6
  89. data/test/engine_rake_tasks_test.rb +39 -0
  90. data/test/helper_test.rb +79 -77
  91. data/test/manifest_test.rb +16 -0
  92. data/test/mounted_app/Rakefile +4 -0
  93. data/test/mounted_app/test/dummy/Rakefile +3 -0
  94. data/test/mounted_app/test/dummy/bin/rails +3 -0
  95. data/test/mounted_app/test/dummy/bin/rake +3 -0
  96. data/test/mounted_app/test/dummy/config/application.rb +10 -0
  97. data/test/mounted_app/test/dummy/config/environment.rb +3 -0
  98. data/test/mounted_app/test/dummy/config/webpacker.yml +75 -0
  99. data/test/mounted_app/test/dummy/config.ru +5 -0
  100. data/test/mounted_app/test/dummy/package.json +7 -0
  101. data/test/rake_tasks_test.rb +1 -10
  102. data/test/test_app/app/{javascript/packs → packs/entrypoints}/application.js +1 -1
  103. data/test/test_app/app/{javascript/packs → packs/entrypoints}/multi_entry.css +0 -0
  104. data/test/test_app/app/{javascript/packs → packs/entrypoints}/multi_entry.js +0 -0
  105. data/test/test_app/config/webpacker.yml +5 -31
  106. data/test/test_app/config/webpacker_other_location.yml +79 -0
  107. data/test/test_app/config/webpacker_public_root.yml +0 -1
  108. data/test/test_app/public/packs/manifest.json +36 -18
  109. data/test/test_app/some.config.js +0 -0
  110. data/test/webpack_runner_test.rb +9 -3
  111. data/test/webpacker_test.rb +17 -0
  112. data/webpacker.gemspec +1 -1
  113. data/yarn.lock +1050 -3966
  114. metadata +59 -91
  115. data/.travis.yml +0 -43
  116. data/docs/assets.md +0 -119
  117. data/docs/cloud9.md +0 -310
  118. data/docs/css.md +0 -308
  119. data/docs/docker.md +0 -68
  120. data/docs/engines.md +0 -213
  121. data/docs/env.md +0 -63
  122. data/docs/es6.md +0 -72
  123. data/docs/folder-structure.md +0 -66
  124. data/docs/integrations.md +0 -220
  125. data/docs/misc.md +0 -23
  126. data/docs/props.md +0 -223
  127. data/docs/target.md +0 -22
  128. data/docs/testing.md +0 -136
  129. data/docs/typescript.md +0 -190
  130. data/docs/v4-upgrade.md +0 -142
  131. data/docs/webpack-dev-server.md +0 -92
  132. data/docs/webpack.md +0 -364
  133. data/docs/yarn.md +0 -23
  134. data/lib/install/angular.rb +0 -23
  135. data/lib/install/coffee.rb +0 -25
  136. data/lib/install/config/.browserslistrc +0 -1
  137. data/lib/install/config/babel.config.js +0 -76
  138. data/lib/install/config/postcss.config.js +0 -12
  139. data/lib/install/config/webpack/environment.js +0 -3
  140. data/lib/install/elm.rb +0 -39
  141. data/lib/install/erb.rb +0 -25
  142. data/lib/install/examples/angular/hello_angular/app/app.component.ts +0 -9
  143. data/lib/install/examples/angular/hello_angular/app/app.module.ts +0 -16
  144. data/lib/install/examples/angular/hello_angular/index.ts +0 -8
  145. data/lib/install/examples/angular/hello_angular/polyfills.ts +0 -73
  146. data/lib/install/examples/angular/hello_angular.js +0 -7
  147. data/lib/install/examples/coffee/hello_coffee.coffee +0 -4
  148. data/lib/install/examples/elm/Main.elm +0 -55
  149. data/lib/install/examples/elm/hello_elm.js +0 -16
  150. data/lib/install/examples/erb/hello_erb.js.erb +0 -6
  151. data/lib/install/examples/react/babel.config.js +0 -93
  152. data/lib/install/examples/react/hello_react.jsx +0 -26
  153. data/lib/install/examples/react/tsconfig.json +0 -21
  154. data/lib/install/examples/stimulus/application.js +0 -1
  155. data/lib/install/examples/stimulus/controllers/hello_controller.js +0 -18
  156. data/lib/install/examples/stimulus/controllers/index.js +0 -9
  157. data/lib/install/examples/svelte/app.svelte +0 -11
  158. data/lib/install/examples/svelte/hello_svelte.js +0 -20
  159. data/lib/install/examples/typescript/hello_typescript.ts +0 -4
  160. data/lib/install/examples/typescript/tsconfig.json +0 -24
  161. data/lib/install/examples/vue/app.vue +0 -22
  162. data/lib/install/examples/vue/hello_vue.js +0 -72
  163. data/lib/install/loaders/coffee.js +0 -6
  164. data/lib/install/loaders/elm.js +0 -25
  165. data/lib/install/loaders/erb.js +0 -11
  166. data/lib/install/loaders/svelte.js +0 -9
  167. data/lib/install/loaders/vue.js +0 -6
  168. data/lib/install/react.rb +0 -18
  169. data/lib/install/stimulus.rb +0 -12
  170. data/lib/install/svelte.rb +0 -29
  171. data/lib/install/typescript.rb +0 -39
  172. data/lib/install/vue.rb +0 -49
  173. data/lib/tasks/installers.rake +0 -42
  174. data/package/config_types/__tests__/config_list.js +0 -118
  175. data/package/config_types/__tests__/config_object.js +0 -43
  176. data/package/config_types/config_list.js +0 -75
  177. data/package/config_types/config_object.js +0 -55
  178. data/package/config_types/index.js +0 -7
  179. data/package/rules/module.css.js +0 -3
  180. data/package/rules/module.sass.js +0 -8
  181. data/package/rules/node_modules.js +0 -22
  182. data/package/utils/__tests__/deep_assign.js +0 -32
  183. data/package/utils/__tests__/deep_merge.js +0 -10
  184. data/package/utils/__tests__/get_style_rule.js +0 -65
  185. data/package/utils/__tests__/objectify.js +0 -9
  186. data/package/utils/deep_assign.js +0 -22
  187. data/package/utils/deep_merge.js +0 -22
  188. data/package/utils/objectify.js +0 -3
data/docs/integrations.md DELETED
@@ -1,220 +0,0 @@
1
- # Integrations
2
-
3
- Webpacker ships with basic out-of-the-box integration for React, Angular, Vue and Elm.
4
- You can see a list of available commands/tasks by running `bundle exec rails webpacker`:
5
-
6
- ## React
7
-
8
- To use Webpacker with [React](https://facebook.github.io/react/), create a
9
- new Rails 5.1+ app using `--webpack=react` option:
10
-
11
- ```bash
12
- # Rails 5.1+
13
- rails new myapp --webpack=react
14
- ```
15
-
16
- (or run `bundle exec rails webpacker:install:react` in an existing Rails app already
17
- setup with Webpacker).
18
-
19
- The installer will add all relevant dependencies using Yarn, changes
20
- to the configuration files, and an example React component to your
21
- project in `app/javascript/packs` so that you can experiment with React right away.
22
-
23
-
24
- ## Angular with TypeScript
25
-
26
- To use Webpacker with [Angular](https://angular.io/), create a
27
- new Rails 5.1+ app using `--webpack=angular` option:
28
-
29
- ```bash
30
- # Rails 5.1+
31
- rails new myapp --webpack=angular
32
- ```
33
-
34
- (or run `bundle exec rails webpacker:install:angular` on a Rails app already
35
- setup with Webpacker).
36
-
37
- The installer will add the TypeScript and Angular core libraries using Yarn alongside
38
- a few changes to the configuration files. An example component written in
39
- TypeScript will also be added to your project in `app/javascript` so that
40
- you can experiment with Angular right away.
41
-
42
- By default, Angular uses a JIT compiler for development environment. This
43
- compiler is not compatible with restrictive CSP (Content Security
44
- Policy) environments like Rails 5.2+. You can use Angular AOT compiler
45
- in development with the [@ngtools/webpack](https://www.npmjs.com/package/@ngtools/webpack#usage) plugin.
46
-
47
- Alternatively if you're using Rails 5.2+ you can enable `unsafe-eval` rule for your
48
- development environment. This can be done in the `config/initializers/content_security_policy.rb`
49
- with the following code:
50
-
51
- ```ruby
52
- Rails.application.config.content_security_policy do |policy|
53
- if Rails.env.development?
54
- policy.script_src :self, :https, :unsafe_eval
55
- else
56
- policy.script_src :self, :https
57
- end
58
- end
59
- ```
60
-
61
-
62
- ## Vue
63
-
64
- To use Webpacker with [Vue](https://vuejs.org/), create a
65
- new Rails 5.1+ app using `--webpack=vue` option:
66
-
67
- ```bash
68
- # Rails 5.1+
69
- rails new myapp --webpack=vue
70
- ```
71
- (or run `bundle exec rails webpacker:install:vue` on a Rails app already setup with Webpacker).
72
-
73
- The installer will add Vue and its required libraries using Yarn alongside
74
- automatically applying changes needed to the configuration files. An example component will
75
- be added to your project in `app/javascript` so that you can experiment with Vue right away.
76
-
77
- If you're using Rails 5.2+ you'll need to enable `unsafe-eval` rule for your development environment.
78
- This can be done in the `config/initializers/content_security_policy.rb` with the following
79
- configuration:
80
-
81
- ```ruby
82
- Rails.application.config.content_security_policy do |policy|
83
- if Rails.env.development?
84
- policy.script_src :self, :https, :unsafe_eval
85
- else
86
- policy.script_src :self, :https
87
- end
88
- end
89
- ```
90
- You can read more about this in the [Vue docs](https://vuejs.org/v2/guide/installation.html#CSP-environments).
91
-
92
- ### Lazy loading integration
93
-
94
- See [docs/es6](es6.md) to know more about Webpack and Webpacker configuration.
95
-
96
- For instance, you can lazy load Vue JS components:
97
-
98
- Before:
99
- ```js
100
- import Vue from 'vue'
101
- import { VCard } from 'vuetify/lib'
102
-
103
- Vue.component('VCard', VCard)
104
- ```
105
-
106
- After:
107
- ```js
108
- import Vue from 'vue'
109
-
110
- // With destructuring assignment
111
- Vue.component('VCard', import('vuetify/lib').then(({ VCard }) => VCard)
112
-
113
- // Or without destructuring assignment
114
- Vue.component('OtherComponent', () => import('./OtherComponent'))
115
- ```
116
-
117
- You can use it in a Single File Component as well:
118
-
119
- ```html
120
- <template>
121
- ...
122
- </template>
123
-
124
- <script>
125
- export default {
126
- components: {
127
- OtherComponent: () => import('./OtherComponent')
128
- }
129
- }
130
- </script>
131
- ```
132
-
133
- By wrapping the import function into an arrow function, Vue will execute it only when it gets requested, loading the module in that moment.
134
-
135
- ##### Automatic registration
136
-
137
- ```js
138
- /**
139
- * The following block of code may be used to automatically register your
140
- * Vue components. It will recursively scan this directory for the Vue
141
- * components and automatically register them with their "basename".
142
- *
143
- * Eg. ./components/OtherComponent.vue -> <other-component></other-component>
144
- * Eg. ./UI/ButtonComponent.vue -> <button-component></button-component>
145
- */
146
-
147
- const files = require.context('./', true, /\.vue$/i)
148
- files.keys().map(key => {
149
- const component = key.split('/').pop().split('.')[0]
150
-
151
- // With Lazy Loading
152
- Vue.component(component, () => import(`${key}`))
153
-
154
- // Or without Lazy Loading
155
- Vue.component(component, files(key).default)
156
- })
157
- ```
158
-
159
- ## Elm
160
-
161
- To use Webpacker with [Elm](http://elm-lang.org), create a
162
- new Rails 5.1+ app using `--webpack=elm` option:
163
-
164
- ```
165
- # Rails 5.1+
166
- rails new myapp --webpack=elm
167
- ```
168
-
169
- (or run `bundle exec rails webpacker:install:elm` on a Rails app already setup with Webpacker).
170
-
171
- The Elm library and its core packages will be added via Yarn and Elm.
172
- An example `Main.elm` app will also be added to your project in `app/javascript`
173
- so that you can experiment with Elm right away.
174
-
175
- ## Svelte
176
-
177
- To use Webpacker with [Svelte](https://svelte.dev), create a
178
- new Rails 5.1+ app using `--webpack=svelte` option:
179
-
180
- ```
181
- # Rails 5.1+
182
- rails new myapp --webpack=svelte
183
- ```
184
-
185
- (or run `bundle exec rails webpacker:install:svelte` on a Rails app already setup with Webpacker).
186
-
187
- Please play with the [Svelte Tutorial](https://svelte.dev/tutorial/basics) or learn more about its API at https://svelte.dev/docs
188
-
189
- ## Stimulus
190
-
191
- To use Webpacker with [Stimulus](http://stimulusjs.org), create a
192
- new Rails 5.1+ app using `--webpack=stimulus` option:
193
-
194
- ```
195
- # Rails 5.1+
196
- rails new myapp --webpack=stimulus
197
- ```
198
-
199
- (or run `bundle exec rails webpacker:install:stimulus` on a Rails app already setup with Webpacker).
200
-
201
- Please read [The Stimulus Handbook](https://stimulusjs.org/handbook/introduction) or learn more about its source code at https://github.com/stimulusjs/stimulus
202
-
203
- ## CoffeeScript
204
-
205
- To add [CoffeeScript](http://coffeescript.org/) support,
206
- run `bundle exec rails webpacker:install:coffee` on a Rails app already
207
- setup with Webpacker.
208
-
209
- An example `hello_coffee.coffee` file will also be added to your project
210
- in `app/javascript/packs` so that you can experiment with CoffeeScript right away.
211
-
212
- ## Erb
213
-
214
- To add [Erb](https://apidock.com/ruby/ERB) support in your JS templates,
215
- run `bundle exec rails webpacker:install:erb` on a Rails app already
216
- setup with Webpacker.
217
-
218
- An example `hello_erb.js.erb` file will also be added to your project
219
- in `app/javascript/packs` so that you can experiment with Erb-flavoured
220
- javascript right away.
data/docs/misc.md DELETED
@@ -1,23 +0,0 @@
1
- # How-Tos
2
-
3
-
4
- ## Ignoring swap files
5
-
6
- If you are using vim or emacs and want to ignore certain files you can add `ignore-loader`:
7
-
8
- ```
9
- yarn add ignore-loader
10
- ```
11
-
12
- and add `ignore-loader` to `config/webpack/environment.js`
13
-
14
- ```js
15
- // ignores vue~ swap files
16
- const { environment } = require('@rails/webpacker')
17
- environment.loaders.append('ignore', {
18
- test: /.vue~$/,
19
- loader: 'ignore-loader'
20
- })
21
- ```
22
-
23
- And now all files with `.vue~` will be ignored by the webpack compiler.
data/docs/props.md DELETED
@@ -1,223 +0,0 @@
1
- # Props
2
-
3
-
4
- ## React
5
-
6
- If you need more advanced React-integration, like server rendering, redux, or react-router, see [shakacode/react_on_rails](https://github.com/shakacode/react_on_rails), [react-rails](https://github.com/reactjs/react-rails), and [webpacker-react](https://github.com/renchap/webpacker-react).
7
-
8
- If you're not concerned with view helpers to pass props or server rendering, can do it yourself:
9
-
10
- ```erb
11
- <%# views/layouts/application.html.erb %>
12
-
13
- <%= content_tag :div,
14
- id: "hello-react",
15
- data: {
16
- message: 'Hello!',
17
- name: 'David'
18
- }.to_json do %>
19
- <% end %>
20
- ```
21
-
22
- ```js
23
- // app/javascript/packs/hello_react.js
24
-
25
- const Hello = props => (
26
- <div className='react-app-wrapper'>
27
- <img src={clockIcon} alt="clock" />
28
- <h5 className='hello-react'>
29
- {props.message} {props.name}!
30
- </h5>
31
- </div>
32
- )
33
-
34
- // Render component with data
35
- document.addEventListener('DOMContentLoaded', () => {
36
- const node = document.getElementById('hello-react')
37
- const data = JSON.parse(node.getAttribute('data'))
38
-
39
- ReactDOM.render(<Hello {...data} />, node)
40
- })
41
- ```
42
-
43
-
44
- ## Vue
45
-
46
- Add the data as attributes in the element you are going to use (or any other element for that matter).
47
-
48
- ```erb
49
- <%= content_tag :div,
50
- id: "hello-vue",
51
- data: {
52
- message: "Hello!",
53
- name: "David"
54
- }.to_json do %>
55
- <% end %>
56
- ```
57
-
58
- This should produce the following HTML:
59
-
60
- ```html
61
- <div id="hello-vue" data="{&quot;message&quot;:&quot;Hello!&quot;,&quot;name&quot;:&quot;David&quot;}"></div>
62
- ```
63
-
64
- Now, modify your Vue app to expect the properties.
65
-
66
- ```html
67
- <template>
68
- <div id="app">
69
- <p>{{test}}{{message}}{{name}}</p>
70
- </div>
71
- </template>
72
-
73
- <script>
74
- export default {
75
- // A child component needs to explicitly declare
76
- // the props it expects to receive using the props option
77
- // See https://vuejs.org/v2/guide/components.html#Props
78
- props: ["message","name"],
79
- data: function () {
80
- return {
81
- test: 'This will display: '
82
- }
83
- }
84
- }
85
- </script>
86
-
87
- <style>
88
- </style>
89
-
90
- ```
91
-
92
- ```js
93
- document.addEventListener('DOMContentLoaded', () => {
94
- // Get the properties BEFORE the app is instantiated
95
- const node = document.getElementById('hello-vue')
96
- const props = JSON.parse(node.getAttribute('data'))
97
-
98
- // Render component with props
99
- new Vue({
100
- render: h => h(App, { props })
101
- }).$mount('#hello-vue');
102
- })
103
- ```
104
-
105
- You can follow same steps for Angular too.
106
-
107
-
108
- ## Elm
109
-
110
- Just like with other implementations, we'll render our data inside a `data`
111
- attribute:
112
-
113
- ```erb
114
- <%= content_tag :div,
115
- id: "hello-elm",
116
- data: {
117
- message: "Hello",
118
- name: "David"
119
- }.to_json do %>
120
- <% end %>
121
- ```
122
-
123
- We parse the JSON data and pass it to Elm as flags:
124
-
125
- ```js
126
- import Elm from '../Main'
127
-
128
- document.addEventListener('DOMContentLoaded', () => {
129
- const node = document.getElementById('hello-elm')
130
- const data = JSON.parse(node.getAttribute('data'))
131
- Elm.Main.embed(node, data)
132
- })
133
- ```
134
-
135
- Defining `Flags` as a `type alias`, we instruct Elm to demand flags `message`
136
- and `name` of type `String` on initialization.
137
-
138
- Using `programWithFlags` we bring all the pieces together:
139
-
140
-
141
- ```elm
142
- module Main exposing (..)
143
-
144
- import Html exposing (Html, programWithFlags, h1, text)
145
- import Html.Attributes exposing (style)
146
-
147
-
148
- -- MODEL
149
-
150
-
151
- type alias Flags =
152
- { message : String
153
- , name : String
154
- }
155
-
156
-
157
- type alias Model =
158
- { message : String
159
- , name : String
160
- }
161
-
162
-
163
- type Msg
164
- = NoOp
165
-
166
-
167
-
168
- -- INIT
169
-
170
-
171
- init : Flags -> ( Model, Cmd Msg )
172
- init flags =
173
- let
174
- { message, name } =
175
- flags
176
- in
177
- ( Model message name, Cmd.none )
178
-
179
-
180
-
181
- -- UPDATE
182
-
183
-
184
- update : Msg -> Model -> ( Model, Cmd Msg )
185
- update msg model =
186
- case msg of
187
- NoOp ->
188
- ( model, Cmd.none )
189
-
190
-
191
-
192
- -- SUBSCRIPTIONS
193
-
194
-
195
- subscriptions : Model -> Sub Msg
196
- subscriptions model =
197
- Sub.none
198
-
199
-
200
-
201
- -- VIEW
202
-
203
-
204
- view : Model -> Html Msg
205
- view model =
206
- h1 [ style [ ( "display", "flex" ), ( "justify-content", "center" ) ] ]
207
- [ text (model.message ++ ", " ++ model.name ++ "!") ]
208
-
209
-
210
-
211
- -- MAIN
212
-
213
-
214
- main : Program Flags Model Msg
215
- main =
216
- programWithFlags
217
- { view = view
218
- , init = init
219
- , update = update
220
- , subscriptions = subscriptions
221
- }
222
-
223
- ```