问题
I am trying to use https://www.npmjs.com/package/chessboardjs package with meteor 1.13. I wrote simple react component to render the board, but it doesn't render images for some reason. The compoent code:
import React from 'react'
import ChessBoard from 'chessboardjs'
export default class GamePage extends React.Component {
render() {
return (
<div>
<div id="chessboard" style={{"width": "400px"}}></div>
</div>
)
}
componentDidMount() {
var board = ChessBoard('chessboard');
}
}
I see that .css from that package is not being used, so maybe I have to import it as well somehow?
回答1:
So the assets for chessboard.js are stored somewhere in static, right? There's a question out there about Flask
which might have your answer,
Integrate chessbord.js with Flask
The idea is to modify the chessboard.js
library, where it src
the images for the board.
Remember to clear your cache if it's not working, as the browser will hold onto to the unedited library.
来源:https://stackoverflow.com/questions/35972456/chessboardjs-npm-package-not-showing-images