Procházet zdrojové kódy

Add version number to tryitout.js for inbuilt cache busting

shalvah před 4 roky
rodič
revize
69a643c47a

+ 1 - 1
resources/views/index.blade.php

@@ -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

+ 2 - 0
src/Tools/Flags.php

@@ -4,5 +4,7 @@ namespace Knuckles\Scribe\Tools;
 
 class Flags
 {
+    public const SCRIBE_VERSION = '2.1.0';
+
     public static $shouldBeVerbose = false;
 }

+ 2 - 1
src/Writing/Writer.php

@@ -9,6 +9,7 @@ use Illuminate\Support\Str;
 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;
 
@@ -288,7 +289,7 @@ class Writer
 
         $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();