How to write angular2 app without node_modules? - node.js

My server-side web project doesn't use npm at all. Now I need to add a new page that needs more SPA feature. I wish to use the newer Angular2, not the old one.
I miss the way that Angular1 can include only a few js files to start working. I know system.js can do this, but all the samples use npm install to get node_modules. I also want to avoid this big and fat folder.
Can I write angular2 app without node_modules?

Related

NPM packages for Next.js - do they need to be in ES5?

I'm bundling a bunch of components I regularly use in apps I create with Next.js into an npm package to make it easier to reuse them between projects, however I'm having difficulty getting it to work.
The big issue I have is that some of my components need to import/require a configuration file from the project root directory (e.g. project/node_modules/mypackage/index.[js/jsx/tsx] needs to import/require project/config.[js/ts]) so I need to ensure the app is able to import components from the npm package, and the npm package is able to import/require from the app.
I use Typescript to compile the npm package (no Webpack or Babel) but I'm not sure what settings to use for target, lib, module and jsx, or if I'm able to just keep it uncompiled as .tsx and .ts files (I'm using the canary branch of Next.js which has built-in Typescript support).
I can't find any information in the documentation, here on SO or via Google search. Any advice?

Whats the role of Node.js in a Polymer setup?

Why do I have to install Node.js to work with Polymer? Just because of npm? Are there any other uses for Node.js in a typical Polymer project? Or is npm just used to install Bower, and Bower to install project dependencies?
Node.js is just use to create project files. create a polymer project you have to use the console polymer CLI.
once files are generated you don't need the CLI until new project or to modify the current one.
You don't need Node.js. You can download all the components you want (plus all their dependencies and polyfills) from Github yourself, and organize them in your project directory. You also don't need any project files if you're going that route.
If you want, however, to conveniently install the components and all their dependencies, you can use bower, or the more recent yarn, which use Node.js. Also, if you want to host your project on Github or similar, it's useful to just commit bower.json which contains a list of all the dependencies (and can then conveniently be installed after cloning the repo), instead of forking all of Polymer's code into your project repo.
Having this said, if all you need is Polymer itself without any of the web components Polymer provides, it's probably even easier to just download Polymer and the required polyfills yourself.
There are more uses for Node.js. You may want to use some packages in your Polymer project, such as Redux, which you can also just download yourself, or install using NPM/Node.

How to working with css framework in npm

I tryed to use css frameworks lots of times. But i cant found any guide what to do. Just some post from other developers. Can you help me with the guide, how to import and use css framework in my expressjs project.
For instance, i started new project with express generator:
express --view=pug --css=sass
next, i installed materialize
npm install materialize-css
What i must to do next??? How to connect js and sass files with my project? How to compile all, if i tryed to do just a website? Where i can find good guides about such things, if i will have more questions?? Thanks!
npm was originally to get Node Module, but with the essort of the Javascript language (and the advent of browserify, webpack,etc), it has a bit grown up.
In fact, you can even download Bootstrap on npm, that is not a server side framework. Browserify permits you to use AMD/RequireJS/CommonJS on client side so node modules can be used on client side. Same goes for Webpack module bundler.
If you npm install bootstrap (if you don't use grunt or gulp file to move to a dist folder), your bootstrap will be located in some location like below.
"./node_modules/bootstrap/bootstrap.min.css"
You need to include this in your .html file.
For sass if you use grunt then you will be using this plugin grunt-sass to convert sass to css and add the destination file to the .html file. Similarly goes for gulp.

Sass setup for Meteor JS App

I have the Meteor app setup with such folder structure. I am not able to get the sass or scss file to create the appropriate css on its own and serve it to the client.
What should I do to make sass work as I prefer sass over scss.
Meteor supports less and stylus out of box my issuing meteor add less or meteor add stylus in your project root directory.
there is also a third party package repository (to be rolled into meteor core in the near future) on which you can find alternatives to many requirements.
For example, there is a third party scss package you can add to your project with meteorite add scss.
Now, the meteorite command here belongs to an npm package that interfaces your app to the atmosphere package repository as well as provide some deeper packaging structure to your app.
When you add the scss package, like in a typical meteor application your coffeescript, handlebars,jade,less,scss,javascript etc files will be compiled/bundled at deploy time and at each save afterwards and be placed in a hidden directory. So you will not be seeing your compiled css alongside your scss files, but the css will have been sent to the browser.

Work on node.js module in place

I'm working on my node.js demo.location.io web app at the same time as my location.io library. I'd like to be able to make changes to the location.io library and push them up to github from inside the node_modules folder. Is there any support for this in npm?
(If I understand your question) You can use
npm link
to link your location.io to your local demo.location.io repo. More info here

Resources