Skip to content

Commit

Permalink
Copy kit javascripts to private namespace in public folder
Browse files Browse the repository at this point in the history
We want to make sure that any shared JS files we create can't have name
collisions with files the user wants to create. Putting the files in a
separate namespaced folder mitigates against this.
  • Loading branch information
lfdebrux committed Aug 2, 2022
1 parent 56548d3 commit ffe15f6
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion __tests__/spec/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ describe('the build pipeline', () => {
it('copies javascript to the public folder', () => {
expect(fs.copyFileSync).toHaveBeenCalledWith(
path.join(projectDir, 'lib', 'assets', 'javascripts', 'kit.js'),
path.join('public', 'javascripts', 'kit.js')
path.join('public', '_kit', 'javascripts', 'kit.js')
)

expect(fs.copyFileSync).toHaveBeenCalledWith(
Expand Down
4 changes: 2 additions & 2 deletions app/views/includes/scripts.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
<script src="{{scriptUrl}}"></script>
{% endfor %}

<script src="/public/javascripts/kit.js"></script>
<script src="/public/_kit/javascripts/kit.js"></script>
<script src="/public/javascripts/application.js"></script>

{% if useAutoStoreData %}
<script src="/public/javascripts/auto-store-data.js"></script>
<script src="/public/_kit/javascripts/auto-store-data.js"></script>
{% endif %}
2 changes: 1 addition & 1 deletion lib/build/tasks.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ function generateAssetsSync ({ verbose = false } = {}) {
if (verbose) process.stdout.write('done\n')

if (verbose) process.stdout.write('copying assets...')
copyAssets(libAssetsPath, paths.public)
copyAssets(libAssetsPath, path.join(paths.public, '_kit'))
copyAssets(paths.assets, paths.public)
if (verbose) process.stdout.write('done\n')
}
Expand Down

0 comments on commit ffe15f6

Please sign in to comment.