Cant use SaSS and an option for express - node.js

The old version of express had an option to use sass as the CSS engine for a site. I see now the version I am running (2.5.5) does not offer this up as an option, instead it has vanilla css of stylus.
Can anyone verify that support is still offered.

This GitHub issue is over 6 months old stating Express doesn't support SASS.
you have to use something like LESS, sass.js, Stylus, etc. Stylus /
LESS both support regular css syntax you can check it out here

It appears that this feature has been removed. Use of third party recommended.

Related

is it required babel configuration when I use vite in place of webpack

Recently I was create react app using vite , it is lightweight , less config and fast then compare with webpack . now my question is , is it required bable configuration in Vite project
No, vite does automatic syntax transforms but it only targets browsers that support es modules (firefox & chrome started supporting it around 2018). If you want to support new js features in older browsers you need to add polyfills though. You can read about the exact behavior and how to support even older browsers here.
I think that question need more information about that topic.
Vite.js uses the built-in JavaScript support of the browser, so you don't need to explicitly configure the JavaScript version in Vite.js itself.
When I said Vite.js uses the built-in JavaScript support of the browser, I meant that Vite.js relies on the JavaScript engine of the browser to interpret and run the JavaScript code in your application. The JavaScript engine is the component of the browser that executes JavaScript code. When you visit a web page that contains JavaScript, the browser runs the JavaScript code using its built-in JavaScript engine. This means that the version of JavaScript that is supported by your application is determined by the version of the JavaScript engine that is built into the browser. In the case of Vite.js, the JavaScript code in your application is not transpiled or otherwise modified before being run by the browser. However, if your application uses modern JavaScript syntax that is not supported by the target browsers, you will need to transpile the code to an older version of the language that is supported. In that case, you can use Babel.
No, it is already setup on the background. However if you'd like to adjust Babel's config you can do it. Read the docs here: https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react/README.md

What is the equivalent command of "express-generator --view=pug my_app" for "express-generator-typescript"?

In JavaScript version of NodeJS there is a command as express-generator --view=pug my_app, but what about express-generator-typescript?
Does --view=pug also works with TypeScript version of NodeJS or we should use another option? Or maybe it uses Pug by default?
Hi I'm the creator of express-generator-typescript. There's no template engine options for this library. Because so many people are using SPAs these days I didn't think there was any point. You're free to create a pull request if you'd like though.

To Babel or Not - Confused

I don't know with web apps if you still have to use Babel if Node 4 is out which supports ES6 so why would I need babel anymore for any web related code? Or maybe I don't?
I see most apps are using babel but I wonder if people are pulling it out now or is there middleware people typically use in web apps that still rely on it, thus you have to keep it and keep using babel?
Node v4 doesn't support the full feature set of ES2015 (aka ES6). For those that aren't supported you still can use Babel. You can find a list of node's support of ES2015 features in this page.
You say "web related code", which is too broad, but I assume you're interested in browser support as well. No browser supports all ES2015 features yet, so you should use a transpiler like Babel. You can find a table of feature compatibility here.
You will also find that no transpiler has full support either, so be careful when introducing new features.
It's not likely that projects will stop using transpilers yet. Even less so if they want to support older versions of node.

How to use server side includes with browser-sync

I have some static files which use server side includes (SSI). Those files have .shtml extension. I'm currently using a local apache in the development cycle.
I want to replace that with browser-sync.
How do I enable SSI?
I found a module called browsersync-ssi, but it's unclear how to use it with the browser-sync command line, installed via npm-install.
there are 2 options to use browser-sync with SSI. my browserync-ssi module depends on node-ssi which does not support all SSI features. the "if"- directive is also not stable.
I would only suggest to use it if you can be sure only to use the base features of SSI. includes for example.
another option is to use browser-syncs proxy feature. http://www.browsersync.io/docs/options/#option-proxy
your apache would still run in the background. so its not an actual replacement but a good solution in your case to benefit from browser-sync.
if you just need features like that from SSI but the not the technology and syntax itself I would suggest to switch to another templating engine like ejs or nunjucks as a [browser-sync] middleware.
for example: https://github.com/soenkekluth/browser-sync-ejs

What is the correct way to include backbone & jquery into a project after installing via npm?

I am using Express with Jade and I installed backbone.js and jQuery via npm. Do I copy the appropriate js files into my public/javascript folder or will Jade understand if I use require() inside the view template file?
Please steer me in the right direction.
Thanks
Anything installed with the package manager is available by require(). If you're trying to use the libraries to be rendered client-side, then you shouldn't be installing them server-side.
As hexacyanide says, Anything installed with the package manager is available by require().
If you want to use packages installed via npm in the browser, you may want to take a look at browserify. Although I'd recommend to at first simply using the files provided on the backbone and jQuery websites. It's less to learn.
NPM is only for server side JavaScript packages.
If you want to manage your client side libraries with a package manager take a look at bower, which shares some concepts of NPM, but for the client side.

Resources