Skip to content

Commit

Permalink
Add version number to tryitout.js for inbuilt cache busting
Browse files Browse the repository at this point in the history
  • Loading branch information
shalvah committed Nov 10, 2020
1 parent a507945 commit 69a643c
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion resources/views/index.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<script>
var baseUrl = "{{ $baseUrl }}";
</script>
<script src="js/tryitout.js"></script>
<script src="js/tryitout-{{ \Knuckles\Scribe\Tools\Flags::SCRIBE_VERSION }}.js"></script>
@endif

> Base URL
Expand Down
2 changes: 2 additions & 0 deletions src/Tools/Flags.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,7 @@

class Flags
{
public const SCRIBE_VERSION = '2.1.0';

public static $shouldBeVerbose = false;
}
3 changes: 2 additions & 1 deletion src/Writing/Writer.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
use Knuckles\Pastel\Pastel;
use Knuckles\Scribe\Tools\ConsoleOutputUtils;
use Knuckles\Scribe\Tools\DocumentationConfig;
use Knuckles\Scribe\Tools\Flags;
use Knuckles\Scribe\Tools\Utils;
use Symfony\Component\Yaml\Yaml;

Expand Down Expand Up @@ -288,7 +289,7 @@ public function writeHtmlDocs(): void

$this->pastel->generate($this->sourceOutputPath . '/index.md', $this->staticTypeOutputPath);
// Add our custom JS
copy(__DIR__.'/../../resources/js/tryitout.js', $this->staticTypeOutputPath . '/js/tryitout.js');
copy(__DIR__.'/../../resources/js/tryitout.js', $this->staticTypeOutputPath . '/js/tryitout-'.Flags::SCRIBE_VERSION.'.js');

if (!$this->isStatic) {
$this->performFinalTasksForLaravelType();
Expand Down

0 comments on commit 69a643c

Please sign in to comment.