lichess-org / chessground

Mobile/Web chess UI for lichess.org
https://lichess.org
GNU General Public License v3.0
1.05k stars 260 forks source link

HTML+JS+CSS example? #131

Closed Nikola-Obreshkov closed 4 years ago

Nikola-Obreshkov commented 4 years ago

Is there an example how to set up the chessground in an HTML page? There is a JS build: https://github.com/ornicar/chessground/issues/62 also the basic CSS: https://github.com/ornicar/chessground-examples/blob/master/assets/chessground.css but I can find a basic example JSON config in order to run: var ground = Chessground(document.body, config); Is this possible?

niklasf commented 4 years ago

Something along these lines:

<html>
<body>
<script src="chessground.js"></script>
<script>
var ground = Chessground(document.body, {});
</script>
</body>
</html>
Nikola-Obreshkov commented 4 years ago

This was the first I tried but it doesn't work. It shows an empty rectangle with notations. Only the drawing circles works.

niklasf commented 4 years ago

Make sure the stylesheet is also included. Check your developer console for requests to potentially missing images.

Nikola-Obreshkov commented 4 years ago

My questions is: Is there an example how to use this chess board with a simple HTML+JS+CSS+possible other assets? Otherwise it is just guessing: maybe there are not images, maybe there is svg asset missing, etc.

honkskillet commented 4 years ago

There is CSS missing. Check out issue #134