Merge pull request #1658 from SmallAiTT/iss_4277_fix4release3.0

issue #4277 : Fix a bug of publish.js
issue #4277 : Refactor codes to support compile.