简体   繁体   English

导出我的Node.JS网站以进行部署

[英]Exporting my Node.JS website for deployment

I am trying to export a version of my project without all the unnecessary node modules that come in the node_modules folder. 我正在尝试导出项目的版本,而没有出现在node_modules文件夹中的所有不必要的节点模块。

For the first time I am developing a website using node.js. 我第一次使用node.js开发网站。 I used it to include Bootstrap and jQuery, as well as compiling my sass stylesheet. 我用它包括Bootstrap和jQuery,以及编译我的sass样式表。

Now I want to upload it to the server through FTP, but the host does not support Node.Js. 现在,我想通过FTP将其上传到服务器,但是主机不支持Node.Js。 Therefore I want to 'compile' a version that does not require Node.js. 因此,我想“编译”一个不需要Node.js的版本。

Currently when I try to upload the whole project, I am uploading a couple of thousand, but it's just a small website. 目前,当我尝试上传整个项目时,我上传了几千个,但这只是一个很小的网站。

This is my package.json:- 这是我的package.json:-

{
  "name": "veerman",
  "version": "1.0.0",
  "description": "Veerman Assurantien pkg",
  "main": "init.js",
  "watches": {
    "sass": "styles/**"
  },
  "scripts": {
    "sass": "node-sass styles/ -o dist/css/ --output-style compressed",
    "dev": "rerun-script"
  },
  "repository": {
    "type": "git",
    "url": "Veerman Assurantien"
  },
  "author": "Demiën Drost",
  "license": "ISC",
  "dependencies": {
    "bootstrap": "^3.3.7",
    "jquery": "^3.2.1",
    "normalize.css": "^7.0.0"
  },
  "devDependencies": {
    "node-sass": "^4.6.1",
    "rerun-script": "^0.6.0"
  }
}

So, I want to 'build' the project to be able to run on it's own without all the other junk. 因此,我想“构建”项目,使其能够在没有其他所有垃圾的情况下自行运行。

Depending on how your init.js is written you should be able to do this. 根据init.js的编写方式,您应该可以执行此操作。 I'd test it via running your build command/step, then using something like http-server to verify you don't need any of the nodejs stuff. 我将通过运行构建命令/步骤来测试它,然后使用类似http-server的东西来验证您不需要任何nodejs东西。 Just CD to the dist/ folder, run http-server . 只需CDdist/文件夹,运行http-server . and then goto the url listed in the console. 然后转到控制台中列出的网址。
If that's all great, upload the contents of dist/ 如果一切都很好,请上传dist/的内容

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM