Chessboardjs NPM package, not showing images

百般思念 提交于 2019-12-11 09:55:55

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!