extrategy
aiutiamo aziende e startup a raggiungere i propri obiettivi di business utilizzando internet, la tecnologia e un approccio lean
is the largest ecosystem of open source libraries in the world.
{
"name": "our-dummy-project",
"version": "0.0.1",
"description": "This is a dummy project",
"main": "index.js",
"author": "extrategy",
"license": "MIT",
"scripts": {
"start": "http-server"
},
"dependencies": {
"lodash": "4.17.2"
},
"devDependencies": {
"http-server": "1.0.0"
}
}
a package.json file
npm init
npm install / uninstall
npm run x
npm publish / unpublish
USE IT!
AKA node-style callbacks
Applications that automate time consuming and boring tasks
Make your life easier when developing for the front-end by automating tasks
- compile modified SASS to CSS
- minify javascript and CSS files
- watch for changes
- run tests
...
Created by Ben Alman in 2012, written in node.js, distributed via npm
Thousands of plugins
Tasks defined by configuration
gruntfile.js
Ability to define custom tasks, which can combine multiple existing tasks into a single task or add entirely new functionality
Processed files are stored in tmp folders and then passed as imput to the next task, and so on
LOT OF I/O CALLS
Similar Grunt modular architecture and plugins system
Tasks defined by code
gulpfile.js
Uses node streams: gulp reads the fs directly and passes the data via .pipe() to the next plugin
No use of tmp folders, decreasing the number of I/O calls, improving performance
Defines itself as a
"module bundler"
It splits your app into multiple files. If you have multiple pages in a single-page app, the user only downloads code for just that page. If they go to another page, they don't redownload common code
from this...
...to this
The result is clean, reusable code. Each individual component depends on import-ing its own dependencies, and export-ing what it wants to make public to other modules
- https://nodesource.com/blog/understanding-the-nodejs-event-loop/
- https://www.tutorialspoint.com/nodejs/nodejs_event_loop.htm
- https://www.toptal.com/nodejs/top-10-common-nodejs-developer-mistakes
- https://github.com/substack/stream-handbook
- https://www.keithcirkel.co.uk/how-to-use-npm-as-a-build-tool/
- https://github.com/petehunt/webpack-howto
- https://blog.madewithenvy.com/getting-started-with-webpack-2-ed2b86c68783#.vgz8hdxf3
- https://medium.freecodecamp.com/javascript-modules-a-beginner-s-guide-783f7d7a5fcc#.o1j0ymmrt
https://prometeia-spa.slack.com/
#formazione
By extrategy