본문 바로가기
728x90
반응형

퍼블리싱/npm7

버전이 안맞을때 원하는 버전으로 다시 설치 (다운그레이드) npm uninstall 삭제할모듈이름 npm install 모듈이름@원하는버전 예시 현재 del 버전 7.0.0이 설치되어 있는데 6.1.1 버전으로 다운그레이드 하고싶으면 npm uninstall del npm install del@6.1.1 하면 원하는 버전으로 설치 완료! 2022. 8. 1.
[npm] 여러파일의(.css, .html) css 를 하나의 css 파일로 합치기 https://www.npmjs.com/package/css-purge css-purge A CSS tool written in Node JS as a command line app or library for the purging, burning, reducing, shortening, compressing, cleaning, trimming and formatting of duplicate, extra, excess or bloated CSS. www.npmjs.com >>npm init npm 시작 >> npm install css-purge -g 설치 >>css-purge -i "파일1.css, 파일2.css" -o 결과파일명.css 파일1과 파일2의 css를 합친 결과파일명.css 로 압축저장 >.. 2019. 6. 17.
[npm] .js 또는 .css 파일 압축하기 minify >> npm init npm 실행 >>npm install minify >>npm install fs 필요한것 설치 index.js 파일 생성(.css 파일 .js 파일 둘다 압축가능) const minify = require('minify'); var fs = require('fs'); minify('파일경로/파일명') //해당파일 압축 .then(function(result){ //결과를 저장 console.log(result); fs.writeFile('저장할경로/저장할파일명',result, function(error, data){ //변환된 내용을 파일로 저장한다. if(error){throw error} }); }) .catch(console.error); >>node index.js 2019. 6. 14.
[npm] 자바스크립트 파일(.js) 압축및난독화하는 방법 uglify-js 압축과 난독화를 진행한다 압축 : 줄바꿈,공백,들여쓰기 제거 , 축약, 사용하지않는 변수제거, 주석제거, 디머깅 문구 제거, 무의미한 코드제거 난독화 : 코드분석하기 어렵게 만든다 (변수명 함수명등이 줄어 용량감소) >>npm init npm 시작 >>npm install uglify-js uglify-js 설치 >>uglifyjs 변환할파일경로/파일명.js -o 저장할경로/저장할파일명.js -m 2019. 6. 14.
728x90
반응형