• Галп не сжимает картинки после их изменения?

    @Ourmine Автор вопроса
    Михаил, копировал изображения в дист
  • Как сохранить обьект в get запросе axios в свой обьект или массив?

    @Ourmine Автор вопроса
    Евгений, Да возвращает промис а не данные.Хотел подставить их значения в отдельных местах, хотя это уже делаю внутри реквеста а не сохранив их данные в отдельный массив.
  • Проблема с подключением axios?

    @Ourmine Автор вопроса
    Евгений Щербаков, куда именно? В devDependencies?
  • Проблема с подключением axios?

    @Ourmine Автор вопроса
    настраивал все при помощи галпа

    "use strict"
    
    let project_folder="dist";
    let source_code="src";
    
    let path={
    	build:{
    		html: project_folder + "/",
    		css: project_folder + "/css/",
    		js: project_folder + "/js/",
    		img: project_folder + "/img/",
    		font: project_folder + "/font/",
    	},
    
    	src:{
    		html: [source_code + "/*.html", "!" + source_code + "/_*.html"],
    		css: source_code + "/scss/style.scss",
    		js: source_code + "/js/main.js",
    		img: source_code + "/img/**/*.{jpg,png,svg,gif,ico,webp}",
    		font: source_code + "/font/*.ttf",
    	},
    
    	watch:{
    		html: source_code + "/**/*.html",
    		css: source_code + "/scss/**/*.scss",
    		js: source_code + "/js/**/*.js",
    		img: source_code + "/img/**/*.{jpg,png,svg,gif,ico,webp}",
    	},
    	 
    	clean:"./" + project_folder + "/"	 
    }
    
    let {src, dest} = require('gulp'),
    	gulp = require ("gulp"),
    	browsersync = require ("browser-sync").create(),
    	fileinclude = require ("gulp-file-include"),
    	del = require ("del"),
    	scss = require ("gulp-sass"),
    	autoprefixer = require ("gulp-autoprefixer"),
    	media_queries = require ("gulp-group-css-media-queries"),
    	clean_css = require ("gulp-clean-css"),
    	rename = require ("gulp-rename"),
    	uglify = require ("gulp-uglify-es").default,
    	imagemin = require ("gulp-imagemin"),
    	webp = require ("gulp-webp"),
    	webphtml = require ("gulp-webp-html"),
    	webpcss = require ("gulp-webpcss"),
    	svgSprite = require ("gulp-svg-sprite"),
    	ttf2woff = require ("gulp-ttf2woff"),
    	tt2woff = require ("gulp-ttf2woff2"),
    	fonter = require ("gulp-fonter");
    
    function browserSync(params){
    	browsersync.init({
    		server:{
    			baseDir:"./" + project_folder + "/"
    		},
    		port:3000,
    		notify:false
    	})
    }
    
    function html(){
    	return src(path.src.html)	
    		.pipe(fileinclude())
    		.pipe(webphtml())
    		.pipe(dest(path.build.html))
    		.pipe(browsersync.stream())
    }
    
    function css(){
    	return src(path.src.css)
    		.pipe(
    			scss({
    				outputStyle:"expanded"
    			})
    		)
    		.pipe(
    			media_queries()
    		)
    		.pipe(
    			autoprefixer({
    				overrideBrowserlist: ["last 5 versions"],
    				cascade: true
    			})
    		)
    		.pipe(webpcss())
    		.pipe(dest(path.build.css))
    		.pipe(clean_css())
    		.pipe(
    			rename({
    				extname:".min.css"
    			})
    		)
    		.pipe(dest(path.build.css))
    		.pipe(browsersync.stream())
    }
    
    function js(){
    	return src(path.src.js)	
    		.pipe(fileinclude())
    		.pipe(dest(path.build.js))
    		.pipe(
    			uglify()
    		)
    		.pipe(
    			rename({
    				extname:".min.js"
    			})
    		)
    		.pipe(dest(path.build.js))
    		.pipe(browsersync.stream())
    		
    }
    
    function images(){
    	return src(path.src.img)
    		.pipe(dest(path.build.img))
    		.pipe(src(path.src.img))
    		.pipe(
    			webp({
    				quality:70
    			})
    		)
    		.pipe(
    			imagemin({
    				interlaced:true,
    				progressive:true,
    				optimizationLevel:3,
    				svgoPlugins:[{removeViewBox:true}]	
    			})
    		)
    		.pipe(dest(path.build.img))
    		.pipe(browsersync.stream())
    }
    
    // function fonts(){
    // 	src(path.src.fonts)
    // 		.pipe(tt2woff())
    // 		.pipe(dest(path.build.fonts));
    
    // 	return(path.src.fonts)
    // 		.pipe(ttf2woff2())
    // 		.pipe(dest(path.build.fonts));
    // };
    
    gulp.task("svgSprite", function(){
    	return gulp.src([source_code + "/iconsprite/*.svg"])
    	.pipe(svgSprite({
    		mode:{
    			stack:{
    				sprite:"../icons/icons.svg",
    				example:true
    			}
    		},
    	}
    	))
    	.pipe(dest(path.build.img))
    })
    
    function watchFiles(params){
    	gulp.watch([path.watch.html], html);
    	gulp.watch([path.watch.css], css);
    	gulp.watch([path.watch.js], js);
    	gulp.watch([path.watch.img], images);
    }
    
    function clean(params){
    	return del(path.clean);
    }
    
    let build = gulp.series(clean, gulp.parallel(js, css, html, images));
    let watch=gulp.parallel(build, watchFiles, browserSync);
    
    // exports.fonts = fonts;
    exports.images = images;
    exports.js = js;
    exports.css = css;
    exports.html = html;
    exports.build = build;
    exports.watch = watch;
    exports.default = watch;
  • Как исправить эту сборку галп?

    @Ourmine Автор вопроса
    галп работает правильно он загружается, но в браузере browser-sync пишет CANNOT GET /, в коде наверно где-то накосячил
  • Ошибка при запуске галп?

    @Ourmine Автор вопроса
    iBird Rose, компилится ураа но uglify не работает
  • Ошибка при запуске галп?

    @Ourmine Автор вопроса
    iBird Rose,
    spoiler
    { GulpUglifyError: unable to minify JavaScript
    at createError (/home/ourmine/dev/Asaxiy/asaxiy-frontend/node_modules/gulp-uglify/lib/create-error.js:5:14)
    at /home/ourmine/dev/Asaxiy/asaxiy-frontend/node_modules/gulp-uglify/lib/minify.js:56:15
    at DestroyableTransform._transform (/home/ourmine/dev/Asaxiy/asaxiy-frontend/node_modules/gulp-uglify/composer.js:12:19)
    at DestroyableTransform.Transform._read (/home/ourmine/dev/Asaxiy/asaxiy-frontend/node_modules/readable-stream/lib/_stream_transform.js:184:10)
    at DestroyableTransform.Transform._write (/home/ourmine/dev/Asaxiy/asaxiy-frontend/node_modules/readable-stream/lib/_stream_transform.js:172:83)
    at doWrite (/home/ourmine/dev/Asaxiy/asaxiy-frontend/node_modules/readable-stream/lib/_stream_writable.js:428:64)
    at writeOrBuffer (/home/ourmine/dev/Asaxiy/asaxiy-frontend/node_modules/readable-stream/lib/_stream_writable.js:417:5)
    at DestroyableTransform.Writable.write (/home/ourmine/dev/Asaxiy/asaxiy-frontend/node_modules/readable-stream/lib/_stream_writable.js:334:11)
    at write (/home/ourmine/dev/Asaxiy/asaxiy-frontend/node_modules/vinyl-fs/node_modules/readable-stream/lib/_stream_readable.js:623:24)
    at flow (/home/ourmine/dev/Asaxiy/asaxiy-frontend/node_modules/vinyl-fs/node_modules/readable-stream/lib/_stream_readable.js:632:7)
    at DestroyableTransform.pipeOnReadable (/home/ourmine/dev/Asaxiy/asaxiy-frontend/node_modules/vinyl-fs/node_modules/readable-stream/lib/_stream_readable.js:664:5)
    at DestroyableTransform.emit (events.js:198:13)
    at emitReadable_ (/home/ourmine/dev/Asaxiy/asaxiy-frontend/node_modules/vinyl-fs/node_modules/readable-stream/lib/_stream_readable.js:448:10)
    at emitReadable (/home/ourmine/dev/Asaxiy/asaxiy-frontend/node_modules/vinyl-fs/node_modules/readable-stream/lib/_stream_readable.js:444:5)
    at readableAddChunk (/home/ourmine/dev/Asaxiy/asaxiy-frontend/node_modules/vinyl-fs/node_modules/readable-stream/lib/_stream_readable.js:187:9)
    at DestroyableTransform.Readable.push (/home/ourmine/dev/Asaxiy/asaxiy-frontend/node_modules/vinyl-fs/node_modules/readable-stream/lib/_stream_readable.js:149:10)
    cause:
    { SyntaxError: Unexpected token: name «content», expected: punc «;»
    at JS_Parse_Error.get (eval at (/home/ourmine/dev/Asaxiy/asaxiy-frontend/node_modules/uglify-js/tools/node.js:18:1), :71:23)
    at formatError (internal/util/inspect.js:818:16)
    at formatRaw (internal/util/inspect.js:626:16)
    at formatValue (internal/util/inspect.js:509:10)
    at formatProperty (internal/util/inspect.js:1071:11)
    at formatRaw (internal/util/inspect.js:727:11)
    at formatValue (internal/util/inspect.js:509:10)
    at inspect (internal/util/inspect.js:189:10)
    at Object.formatWithOptions (util.js:84:12)
    at Console.(anonymous function) (console.js:198:15)
    at Console.log (console.js:209:31)
    at DestroyableTransform. (/home/ourmine/dev/Asaxiy/asaxiy-frontend/gulpfile.js:34:10)
    at DestroyableTransform.emit (events.js:203:15)
    at onwriteError (/home/ourmine/dev/Asaxiy/asaxiy-frontend/node_modules/readable-stream/lib/_stream_writable.js:443:12)
    at onwrite (/home/ourmine/dev/Asaxiy/asaxiy-frontend/node_modules/readable-stream/lib/_stream_writable.js:470:11)
    at WritableState.onwrite (/home/ourmine/dev/Asaxiy/asaxiy-frontend/node_modules/readable-stream/lib/_stream_writable.js:180:5)
    message: 'Unexpected token: name «content», expected: punc «;»',
    filename: 'main.js',
    line: 2711,
    col: 8,
    pos: 378893 },
    plugin: 'gulp-uglify',
    fileName: '/home/ourmine/dev/Asaxiy/asaxiy-frontend/assets/js/main.js',
    showStack: false }

  • Ошибка при запуске галп?

    @Ourmine Автор вопроса
    iBird Rose, у меня нет такой файл я поискал