Anotaciones

Hackerman empezó en este curso, y luego hackeó el tiempo

Notas, templates y trucos que he ido recopilando.

360 flip de varial

rem

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

Iniciar proyecto SCSS con Grunt


    // GRUNT PROCESS

	npm init
	npm install grunt --save-dev

	// Create Gruntfile.js

	npm install grunt-contrib-watch --save-dev

	//  npm install grunt-browser-sync   // I don't like it 

	npm install grunt-contrib-sass --save-dev
	npm install grunt-contrib-copy --save-dev
	npm install --save-dev grunt-cwebp

	// Es posible que existan vulnerabilidades
	npm audit fix

Ejemplo de Gruntfile.js


    //Gruntfile.js
	module.exports = function (grunt) {
	    grunt.initConfig({
	        
	      // Watch task config con Sass
	      watch: {
	          options: {
	              nospawn: true,
	              livereload: true
	          },
	  
	          sass: {
	              files: ['src/assets/css/**/*.scss'],
	              tasks: ['sass']
	          },
	          copy: {
	              files: ['src/**'],
	              tasks: ['copy:main']
	          }            
	      },
	  
	      // COPY task congif
	      copy: {
	          main: {
	              expand: true,
	              cwd: 'src/',
	              src: ["**/*", "!css/**/*.scss"],
	              dest: 'dist/'
	          }
	      },
	  
	       
	       // Sass task config
	      sass: {
	          dist: {
	              options: {
	                  style: 'compressed',
	                  noCache: true
	              },
	              files: [{
	                  expand: true,
	                  cwd:    "src/assets/css",
	                  src:    ["*.scss"],
	                  dest:  "src/assets/css",
	                  ext:    ".css"
	              }]
	          }
	      },


	      cwebp: {
	        // static: {
	        //     files: {
	        //         'dist/img-png.webp': 'src/img.png',
	        //         'dist/img-jpg.webp': 'src/img.jpg',
	        //         'dist/img-gif.webp': 'src/img.gif'
	        //     }
	        // },
	        dynamic: {
	            options: {
	                // SET QUALITY OF EXPORTED WEBP (0 - 100)
	                q: 50
	            },
	            files: [{
	                expand: true,
	                cwd: 'src/',
	                src: ['**/*.{png,jpg,gif}'],
	                dest: 'dist/'
	            }]
	        }
		  }
   		});
   
	    grunt.loadNpmTasks('grunt-contrib-watch');
	    grunt.loadNpmTasks('grunt-contrib-sass');
	    grunt.loadNpmTasks('grunt-contrib-copy');
	    grunt.loadNpmTasks('grunt-cwebp');
   
   		//Tarea por defecto
   		grunt.registerTask('default', ['copy', 'cwebp', 'watch']);
  	};