Skip to content

Commit

Permalink
link to v1.0.0 CDN on the website
Browse files Browse the repository at this point in the history
  • Loading branch information
oakmac committed Jun 11, 2019
1 parent bfa31a0 commit fe99037
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 8 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"type": "git",
"url": "git://github.com/oakmac/chessboardjs.git"
},
"browser": "lib/chessboard.js",
"files": ["dist/"],
"dependencies": {
"jquery": ">=3.4.1"
},
Expand Down
14 changes: 12 additions & 2 deletions scripts/website.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,13 @@ const encoding = {encoding: 'utf8'}

// toggle development version
const useDevFile = false
const jsCDNLink = '<script src="https://unpkg.com/@chrisoakman/chessboardjs@1.0.0/dist/chessboard-1.0.0.min.js" integrity="sha384-8Vi8VHwn3vjQ9eUHUxex3JSN/NFqUg3QbPyX8kWyb93+8AC/pPWTzj+nHtbC5bxD" crossorigin="anonymous"></script>'
const cssCDNLink = 'https://unpkg.com/@chrisoakman/chessboardjs@1.0.0/dist/chessboard-1.0.0.min.css'

let chessboardJsScript = jsCDNLink
if (useDevFile) {
chessboardJsScript = '<script src="js/chessboard.js"></script>'
}

// grab some mustache templates
const docsTemplate = fs.readFileSync('templates/docs.mustache', encoding)
Expand Down Expand Up @@ -80,9 +87,10 @@ function writeHomepage () {
const headHTML = mustache.render(headTemplate, {pageTitle: 'Homepage'})

const html = mustache.render(homepageTemplate, {
chessboardJsScript: chessboardJsScript,
example2: homepageExample2,
footer: footerTemplate,
head: headHTML,
example2: homepageExample2
head: headHTML
})
fs.writeFileSync('website/index.html', html, encoding)
}
Expand All @@ -92,6 +100,7 @@ function writeExamplesPage () {
const headerHTML = mustache.render(headerTemplate, {examplesActive: true})

const html = mustache.render(examplesTemplate, {
chessboardJsScript: chessboardJsScript,
examplesJavaScript: buildExamplesJS(),
footer: footerTemplate,
head: headHTML,
Expand Down Expand Up @@ -124,6 +133,7 @@ function writeSingleExamplePage (example) {
if (isIntegrationExample(example)) {
example.includeChessJS = true
}
example.chessboardJsScript = chessboardJsScript
const html = mustache.render(singleExampleTemplate, example)
fs.writeFileSync('website/examples/' + example.id + '.html', html, encoding)
}
Expand Down
2 changes: 1 addition & 1 deletion templates/_head.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@
<link rel="shortcut icon" href="img/favicon.ico" type="image/x-icon" />
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Open+Sans:300,400,600|Roboto+Mono">
<link rel="stylesheet" href="css/website.css" />
<link rel="stylesheet" href="css/chessboard.css" />
<link rel="stylesheet" href="https://unpkg.com/@chrisoakman/chessboardjs@1.0.0/dist/chessboard-1.0.0.min.css" integrity="sha384-q94+BZtLrkL1/ohfjR8c6L+A6qzNH9R2hBLwyoAfu3i/WCvQjzL2RQJ3uNHDISdU" crossorigin="anonymous">
</head>
2 changes: 1 addition & 1 deletion templates/examples.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
</script>
<script src="js/jquery-3.4.1.min.js"></script>
<script src="js/prettify.min.js"></script>
<script src="js/chessboard.js"></script>
{{{chessboardJsScript}}}
<script src="js/chess-0.10.2.min.js"></script>
<script src="js/examples.js"></script>
</body>
Expand Down
2 changes: 1 addition & 1 deletion templates/homepage.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@

<script src="js/jquery-3.4.1.min.js"></script>
<script src="js/prettify.min.js"></script>
<script src="js/chessboard.js"></script>
{{{chessboardJsScript}}}
<script>
;(function () {
function isTouchDevice () {
Expand Down
4 changes: 2 additions & 2 deletions templates/single-example.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
<title>chessboardjs Example #{{{id}}} - {{{name}}}</title>
<base href="../" />
<link rel="stylesheet" href="css/chessboard.css" />
<link rel="stylesheet" href="https://unpkg.com/@chrisoakman/chessboardjs@1.0.0/dist/chessboard-1.0.0.min.css" integrity="sha384-q94+BZtLrkL1/ohfjR8c6L+A6qzNH9R2hBLwyoAfu3i/WCvQjzL2RQJ3uNHDISdU" crossorigin="anonymous">
{{#css}}
<style type="text/css">
{{{css}}}
Expand All @@ -22,7 +22,7 @@
<!--- End Example HTML -------------------------------------------------------->

<script src="js/jquery-3.4.1.min.js"></script>
<script src="js/chessboard.js"></script>
{{{chessboardJsScript}}}
{{#includeChessJS}}
<script src="https://cdnjs.cloudflare.com/ajax/libs/chess.js/0.10.2/chess.js" integrity="sha384-s3XgLpvmHyscVpijnseAmye819Ee3yaGa8NxstkJVyA6nuDFjt59u1QvuEl/mecz" crossorigin="anonymous"></script>
{{/includeChessJS}}
Expand Down

0 comments on commit fe99037

Please sign in to comment.