tips 0007 works folder - cwtickle/danoniplus-docs GitHub Wiki

English | Japanese

^ Back to Tips Index

Place work pages in an arbitrary directory

  • Starting from v19.4.1, you can place artwork pages in any folder.
  • Also, as of v27.1.0, it is no longer necessary to specify links in css files.
  • You can also launch it in other folders by modifying the relative path part of the <script> tag in the <head> tag.

Usage

Usage example

  • If you have html for your work in danoniplus/danoni/ (js files are in danoniplus/js/)
<script src="../js/danoni_main.js" charset="UTF-8">
  • If you have html for your work in danoniplus/danoni/sub/ (js files are in danoniplus/js/)
<script src="../../js/danoni_main.js" charset="UTF-8">
  • When using js/css/svg files placed in GitHub Pages
    • When using this method, you do not need to upload individual files such as js files and css files.
    • If you use individual js/css files, you can use ver38.1.0 or later, and for individual skin files, you can use ver40.4.0 or later.
<script src="https://cwtickle.github.io/danoniplus/js/danoni_main.js" charset="UTF-8">
  • When using js/css/svg files of jsdelivr and UNPKG
    • For jsdelivr and UNPKG, version specification is possible.
<!-- jsdelivr (Latest Major, Latest Minor (v40), Latest Patch (v40.5), Static) -->
<script src="https://cdn.jsdelivr.net/npm/danoniplus/js/danoni_main.min.js" charset="UTF-8">
<script src="https://cdn.jsdelivr.net/npm/danoniplus@40/js/danoni_main.min.js" charset="UTF-8">
<script src="https://cdn.jsdelivr.net/npm/[email protected]/js/danoni_main.min.js" charset="UTF-8">
<script src="https://cdn.jsdelivr.net/npm/[email protected]/js/danoni_main.min.js" charset="UTF-8">
<!-- UNPKG (Latest Major, Latest Minor (v40), Latest Patch (v40.5), Static) -->
<script src="https://unpkg.com/danoniplus/js/danoni_main.js" charset="UTF-8">
<script src="https://unpkg.com/danoniplus@40/js/danoni_main.js" charset="UTF-8">
<script src="https://unpkg.com/[email protected]/js/danoni_main.js" charset="UTF-8">
<script src="https://unpkg.com/[email protected]/js/danoni_main.js" charset="UTF-8">

Dynamically update files using jsdelivr's CDN

  • You can use jsdelivr's CDN to dynamically change the version of the file.
  • Save and overwrite the following file as danoni_main.js and prepare "version.txt" on the js folder.
// Get version information and generate script tags
const randTime = Date.now();
fetch(`../js/version.txt?${randTime}`)
  .then(response => response.text())
  .then(version => {
    const script = document.createElement('script');
    script.src = `https://cdn.jsdelivr.net/npm/danoniplus@${version}/js/danoni_main.min.js`;
    document.head.appendChild(script);
    console.log(`Loaded version: ${version}`);
  })
  .catch(error => {
    console.error('Failed to load version:', error);
  });

version.txt

  • In version.txt, specify the version name in the format "x.y.z".
40.5.4

^ Back to Tips Index

⚠️ **GitHub.com Fallback** ⚠️