Chessboardjs NPM package, not showing images

2019-07-22 14:08发布

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条回答
爷的心禁止访问
2楼-- · 2019-07-22 14:43

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.

查看更多
登录 后发表回答