Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extract p5-dependencies.js chunk #30520

Merged
merged 3 commits into from
Sep 3, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 8 additions & 0 deletions apps/Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -854,6 +854,14 @@ describe('entry tests', () => {
)
);
}
},
p5lab: {
name: 'p5-dependencies',
priority: 10,
minChunks: 2,
chunks: chunk =>
['spritelab', 'gamelab', 'dance'].includes(chunk.name),
test: module => /p5/.test(module.resource)
}
}
}
Expand Down
5 changes: 2 additions & 3 deletions dashboard/app/helpers/levels_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -305,19 +305,18 @@ def render_app_dependencies
use_weblab = @level.game == Game.weblab
use_phaser = @level.game == Game.craft
use_blockly = !use_droplet && !use_netsim && !use_weblab
use_dance = @level.is_a?(Gamelab) && @level.helper_libraries.try(:include?, 'DanceLab')
use_p5 = @level.is_a?(Gamelab)
hide_source = app_options[:hideSource]
render partial: 'levels/apps_dependencies',
locals: {
app: app_options[:app],
use_droplet: use_droplet,
use_netsim: use_netsim,
use_blockly: use_blockly,
use_applab: use_applab,
use_gamelab: use_gamelab,
use_weblab: use_weblab,
use_phaser: use_phaser,
use_dance: use_dance,
use_p5: use_p5,
hide_source: hide_source,
preload_asset_list: @level.try(:preload_asset_list),
static_asset_base_path: app_options[:baseUrl]
Expand Down
7 changes: 5 additions & 2 deletions dashboard/app/views/levels/_apps_dependencies.html.haml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
-#
Expected locals: app, use_blockly, use_droplet, use_netsim, use_applab, hide_source, static_asset_base_path
Expected locals: app, use_blockly, use_droplet, use_p5, use_applab, hide_source, static_asset_base_path
Provide default values for some of these
- use_blockly ||= false
- use_droplet ||= false
- use_netsim ||= false
- use_p5 ||= false
- use_applab ||= false
- use_gamelab ||= false
- use_weblab ||= false
Expand All @@ -15,6 +15,9 @@
%link{href: asset_path('css/common.css'), rel: 'stylesheet', type: 'text/css'}
%link{href: asset_path("css/#{app}.css"), rel: 'stylesheet', type: 'text/css'}

- if use_p5
%script{src: minifiable_asset_path('js/p5-dependencies.js')}

-# Droplet style dependencies (only when editor present)
- if use_droplet && !hide_source
%link{href: asset_path('css/droplet/droplet.min.css'), rel: 'stylesheet', type: 'text/css'}
Expand Down