Commit 9d21232e authored by AK's avatar AK

add frontend

parent 10d6816c
......@@ -21,17 +21,41 @@ data/logs/*
vendor/*
# Node modules (if you're using npm or yarn for frontend dependencies)
node_modules/*
# IDE and editor files
*.iml
*.ipynb
*.swp
*.vscode
*.idea
frontend/node_modules/*
# Other files that shouldn't be tracked
*.bak
*.old
*.orig
*.tmp
\ No newline at end of file
*.tmp
# Build and compiled files
/.vite
dist/
build/
*.min.css
*.min.js
*.map
# Cache and temporary files
.tmp
.cache
*.tmp
*.log
# IDE and editor files
.vscode/
.idea/
*.iml
*.ipynb
*.swp
*.swo
*.sublime-workspace
*.sublime-project
# OS-specific files
.DS_Store
Thumbs.db
ehthumbs.db
Desktop.ini
\ No newline at end of file
//styles
import './styles/reset.css'
import './styles/main.css'
import './styles/header.css'
import './styles/slider.css'
import './styles/shoplist.css'
import './styles/product.css'
import './styles/addcart.css'
import './styles/header-cart.css'
//import './styles/language_switcher.css'
import './styles/gallery.css'
import './styles/footer.css'
import './styles/tour-filters.css'
//import './styles/noUi.css'
import './styles/slider-range.css'
//noUiSlider
//import noUiSlider from 'nouislider';
//import './frontend/styles/product-gallery.css'
//import './frontend/styles/valute.css'
import './js/langform.js'
//компоненты
import './components/details/details.css'
import './components/details/details.js'
import './components/product-gallery/product-gallery.css'
import './components/product-gallery/product-gallery.js'
import './components/burger/burger.css'
import './components/burger/burger.js'
//scripts
import './js/range.js'
import './js/slider.js'
import './js/gallery.js'
{
"name": "concierges-theme",
"private": true,
"version": "0.0.0",
"type": "module",
"scripts": {
"dev": "vite",
"build": "vite build",
"preview": "vite preview",
"postbuild": "node removeQueryParams.js"
},
"devDependencies": {
"autoprefixer": "^10.4.19",
"cssnano": "^7.0.1",
"postcss": "^8.4.38",
"vite": "^5.2.11"
},
"dependencies": {
"nouislider": "^15.8.1",
"reset-css": "^5.0.2"
}
}
import { readdir, lstatSync, renameSync } from 'fs';
import { join, basename } from 'path';
const assetDirectory = 'dist/assets'; // Укажите путь к папке, где нужно убрать часть имени файла начиная с знака ?
async function removeQueryParams(directory) {
readdir(directory, async (err, files) => {
if (err) {
console.error('Error reading directory:', err);
return;
}
for (const file of files) {
const filePath = join(directory, file);
if (lstatSync(filePath).isDirectory()) {
await removeQueryParams(filePath);
} else {
const fileName = basename(filePath);
const newFileName = fileName.split('?')[0]; // Убираем часть имени файла начиная с знака ?
if (fileName !== newFileName) {
renameSync(filePath, join(directory, newFileName));
}
}
}
});
}
removeQueryParams(assetDirectory);
/**
* View your website at your own local server.
* Example: if you're using WP-CLI then the common URL is: http://localhost:8080.
*
* http://localhost:5173 is serving Vite on development. Access this URL will show empty page.
*
*/
import { defineConfig } from "vite";
import { resolve } from 'path';
export default defineConfig({
plugins: [
{
handleHotUpdate({ file, server }) {
if (file.endsWith('.php')) {
server.ws.send({ type: 'full-reload', path: '*' });
}
}
}
],
build: {
// emit manifest so PHP can find the hashed files
minify: true,
manifest: false,
chunkFileNames: 'assets/[name].js',
cssCodeSplit: false,
rollupOptions: {
input: {
main: resolve(__dirname + '/main.js')
},
output: {
// Используем параметры шаблонизации для добавления хеша к имени файла
entryFileNames: `assets/[name].js?v=[hash]`,
chunkFileNames: `assets/[name].js?v=[hash]`,
assetFileNames: `assets/[name].[ext]?v=[hash]`,
}
}
},
server: {
// required to load scripts from custom host
cors: {
origin: "*"
},
// We need a strict port to match on PHP side.
// You can change it. But, please update it on your .env file to match the same port
strictPort: true,
port: 5173
},
});
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment