Skip to content

Commit 8281879

Browse files
committed
css depured
1 parent 2b2e747 commit 8281879

21 files changed

+8389
-3464
lines changed

package.json

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,24 +12,28 @@
1212
"format": "biome format --write src/",
1313
"check": "biome check src/",
1414
"check:fix": "biome check --fix src/",
15-
"check:fix:all": "biome check --write --unsafe src/"
15+
"check:fix:all": "biome check --write --unsafe src/",
16+
"purge": "purgecss --config purgecss.config.mjs"
1617
},
1718
"dependencies": {
1819
"@astrojs/check": "^0.9.4",
1920
"@astrojs/sitemap": "^3.4.1",
2021
"@fortawesome/fontawesome-free": "^6.7.2",
21-
"astro": "^5.10.0",
2222
"registry.npmjs.org": "^1.0.1",
2323
"typescript": "^5.8.3"
2424
},
2525
"devDependencies": {
2626
"@biomejs/biome": "^2.0.6",
27+
"@fullhuman/postcss-purgecss": "^7.0.2",
2728
"@typescript-eslint/eslint-plugin": "^8.35.0",
2829
"@typescript-eslint/parser": "^8.35.0",
30+
"astro": "^5.11.0",
2931
"astro-eslint-parser": "^1.2.2",
32+
"autoprefixer": "^10.4.21",
3033
"eslint": "^9.29.0",
3134
"eslint-plugin-astro": "^1.3.1",
3235
"jsdom": "^26.1.0",
36+
"postcss": "^8.5.6",
3337
"vitest": "^3.2.4"
3438
}
3539
}

public/assets/js/main-depured.js

Lines changed: 242 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,242 @@
1+
(function ($) {
2+
'use strict';
3+
4+
// Preloader
5+
$(window).on('load', function () {
6+
$('#preloader').delay(500).fadeOut(500);
7+
});
8+
9+
// Button hover effect
10+
$('.btn-hover')
11+
.on('mouseenter', function (e) {
12+
const offset = $(this).offset();
13+
const relX = e.pageX - offset.left;
14+
const relY = e.pageY - offset.top;
15+
$(this).find('span').css({ top: relY, left: relX });
16+
})
17+
.on('mouseout', function (e) {
18+
const offset = $(this).offset();
19+
const relX = e.pageX - offset.left;
20+
const relY = e.pageY - offset.top;
21+
$(this).find('span').css({ top: relY, left: relX });
22+
});
23+
24+
// Mobile menus
25+
$('#mobile-menu').meanmenu({
26+
meanMenuContainer: '.mobile-menu',
27+
meanScreenWidth: '991',
28+
meanExpand: ['<i class="fas fa-plus"></i>'],
29+
});
30+
$('#mobile-menu-2').meanmenu({
31+
meanMenuContainer: '.mobile-menu-2',
32+
meanScreenWidth: '4000',
33+
meanExpand: ['<i class="fas fa-plus"></i>'],
34+
});
35+
36+
// Sidebar
37+
$('.offcanvas__close,.offcanvas__overlay').on('click', function () {
38+
$('.offcanvas__info').removeClass('info-open');
39+
$('.offcanvas__overlay').removeClass('overlay-open');
40+
});
41+
$('.sidebar__toggle').on('click', function () {
42+
$('.offcanvas__info').addClass('info-open');
43+
$('.offcanvas__overlay').addClass('overlay-open');
44+
});
45+
46+
// Body overlay
47+
$('.body-overlay').on('click', function () {
48+
$('.offcanvas__area').removeClass('offcanvas-opened');
49+
$('.df-search-area').removeClass('opened');
50+
$('.body-overlay').removeClass('opened');
51+
});
52+
53+
// Sticky header
54+
$(window).on('scroll', function () {
55+
$('#header-sticky').toggleClass('sticky', $(this).scrollTop() > 250);
56+
});
57+
58+
// Data attributes
59+
$('[data-background]').each(function () {
60+
$(this).css('background-image', 'url(' + $(this).attr('data-background') + ')');
61+
});
62+
$('[data-width]').each(function () {
63+
$(this).css('width', $(this).attr('data-width'));
64+
});
65+
$('[data-bg-color]').each(function () {
66+
$(this).css('background-color', $(this).attr('data-bg-color'));
67+
});
68+
69+
// Popups
70+
$('.popup-image').magnificPopup({
71+
type: 'image',
72+
gallery: { enabled: true },
73+
});
74+
$('.popup-video').magnificPopup({ type: 'iframe' });
75+
76+
// Counters
77+
$('.counter').counterUp({ delay: 10, time: 1000 });
78+
79+
// AOS animations
80+
AOS.init({ duration: 600, easing: 'ease-in-out', once: true, offset: 100 });
81+
82+
// Current year in footer
83+
const yearElement = document.getElementById('current-year');
84+
if (yearElement) {
85+
yearElement.textContent = new Date().getFullYear();
86+
}
87+
88+
// Back to top
89+
const progressPath = document.querySelector('.backtotop-wrap path');
90+
if (progressPath) {
91+
const pathLength = progressPath.getTotalLength();
92+
progressPath.style.transition = progressPath.style.WebkitTransition = 'none';
93+
progressPath.style.strokeDasharray = pathLength + ' ' + pathLength;
94+
progressPath.style.strokeDashoffset = pathLength;
95+
progressPath.getBoundingClientRect();
96+
progressPath.style.transition =
97+
progressPath.style.WebkitTransition = 'stroke-dashoffset 10ms linear';
98+
const updateProgress = function () {
99+
const scroll = $(window).scrollTop();
100+
const height = $(document).height() - $(window).height();
101+
const progress = pathLength - (scroll * pathLength) / height;
102+
progressPath.style.strokeDashoffset = progress;
103+
};
104+
updateProgress();
105+
$(window).scroll(updateProgress);
106+
const offset = 150;
107+
const duration = 550;
108+
$(window).on('scroll', function () {
109+
$('.backtotop-wrap').toggleClass('active-progress', $(this).scrollTop() > offset);
110+
});
111+
$('.backtotop-wrap').on('click', function (event) {
112+
event.preventDefault();
113+
$('html, body').animate({ scrollTop: 0 }, duration);
114+
});
115+
}
116+
117+
// Swiper sliders
118+
new Swiper('.testimonial-active-2', {
119+
slidesPerView: 2,
120+
spaceBetween: 20,
121+
loop: true,
122+
roundLengths: true,
123+
autoplay: { delay: 3000 },
124+
pagination: { el: '.testimonial-swiper-dot', clickable: true },
125+
navigation: {
126+
nextEl: '.testimonial-button-next',
127+
prevEl: '.testimonial-button-prev',
128+
},
129+
breakpoints: {
130+
1400: { slidesPerView: 2 },
131+
1200: { slidesPerView: 2 },
132+
992: { slidesPerView: 2 },
133+
768: { slidesPerView: 1 },
134+
576: { slidesPerView: 1 },
135+
0: { slidesPerView: 1 },
136+
},
137+
});
138+
139+
new Swiper('.brand-active', {
140+
slidesPerView: 4,
141+
spaceBetween: 99,
142+
loop: true,
143+
roundLengths: true,
144+
autoplay: { delay: 3000 },
145+
breakpoints: {
146+
1400: { slidesPerView: 4 },
147+
1200: { slidesPerView: 3 },
148+
992: { slidesPerView: 3 },
149+
768: { slidesPerView: 2 },
150+
576: { slidesPerView: 2 },
151+
0: { slidesPerView: 1 },
152+
},
153+
speed: 1000,
154+
});
155+
156+
new Swiper('.project-active-1', {
157+
slidesPerView: 2,
158+
spaceBetween: 30,
159+
loop: true,
160+
autoplay: { delay: 2000 },
161+
navigation: {
162+
nextEl: '.project-1-button-next',
163+
prevEl: '.project-1-button-prev',
164+
},
165+
breakpoints: {
166+
1400: { slidesPerView: 4 },
167+
1200: { slidesPerView: 3 },
168+
992: { slidesPerView: 2 },
169+
768: { slidesPerView: 2 },
170+
576: { slidesPerView: 1 },
171+
0: { slidesPerView: 1 },
172+
},
173+
speed: 1000,
174+
});
175+
176+
new Swiper('.service-active-1', {
177+
slidesPerView: 2,
178+
spaceBetween: 30,
179+
loop: true,
180+
roundLengths: true,
181+
autoplay: { delay: 2000 },
182+
navigation: {
183+
nextEl: '.service-1-button-next',
184+
prevEl: '.service-1-button-prev',
185+
},
186+
breakpoints: {
187+
1400: { slidesPerView: 2 },
188+
1200: { slidesPerView: 2 },
189+
992: { slidesPerView: 2 },
190+
768: { slidesPerView: 1 },
191+
576: { slidesPerView: 1 },
192+
0: { slidesPerView: 1 },
193+
},
194+
speed: 1500,
195+
});
196+
197+
if ($('.banner-active').length > 0) {
198+
const sliderActive = '.banner-active';
199+
const sliderInit = new Swiper(sliderActive, {
200+
slidesPerView: 1,
201+
slidesPerColumn: 1,
202+
paginationClickable: true,
203+
fadeEffect: { crossFade: true },
204+
loop: true,
205+
effect: 'fade',
206+
autoplay: { delay: 5000 },
207+
navigation: {
208+
nextEl: '.slider__button-next',
209+
prevEl: '.slider__button-prev',
210+
},
211+
pagination: { el: '.banner-dot', clickable: true },
212+
a11y: false,
213+
});
214+
const animate = function () {
215+
$(sliderActive + ' [data-animation]').each(function () {
216+
const anim = $(this).data('animation');
217+
const delay = $(this).data('delay');
218+
const duration = $(this).data('duration');
219+
$(this)
220+
.removeClass('anim' + anim)
221+
.addClass(anim + ' animated')
222+
.css({
223+
webkitAnimationDelay: delay,
224+
animationDelay: delay,
225+
webkitAnimationDuration: duration,
226+
animationDuration: duration,
227+
})
228+
.one(
229+
'webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend',
230+
function () {
231+
$(this).removeClass(anim + ' animated');
232+
}
233+
);
234+
});
235+
};
236+
animate();
237+
sliderInit.on('slideChange', function () {
238+
$(sliderActive + ' [data-animation]').removeClass('animated');
239+
});
240+
sliderInit.on('slideChange', animate);
241+
}
242+
})(jQuery);

public/assets/js/main.js

Lines changed: 0 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -306,8 +306,6 @@
306306
},
307307
})
308308

309-
// Gramen Home two
310-
311309
var team = new Swiper('.testimonial-active-2', {
312310
slidesPerView: 2,
313311
spaceBetween: 20,
@@ -346,43 +344,6 @@
346344
},
347345
})
348346

349-
var team = new Swiper('.testimonial-active-3', {
350-
slidesPerView: 4,
351-
spaceBetween: 24,
352-
loop: true,
353-
roundLengths: true,
354-
autoplay: {
355-
delay: 3000,
356-
},
357-
pagination: {
358-
el: '.bd-swiper-dot',
359-
clickable: true,
360-
},
361-
navigation: {
362-
nextEl: '.testimonial-button-next',
363-
prevEl: '.testimonial-button-prev',
364-
},
365-
breakpoints: {
366-
1400: {
367-
slidesPerView: 4,
368-
},
369-
1200: {
370-
slidesPerView: 2,
371-
},
372-
992: {
373-
slidesPerView: 2,
374-
},
375-
768: {
376-
slidesPerView: 2,
377-
},
378-
576: {
379-
slidesPerView: 1,
380-
},
381-
0: {
382-
slidesPerView: 1,
383-
},
384-
},
385-
})
386347

387348

388349
/*======================================

purgecss.config.mjs

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
content: ['./src/**/*.{astro,html,js,ts}', './public/**/*.html'],
2+
css: [
3+
'./src/assets/css/main.css',
4+
'./src/assets/css/safari-fix.css',
5+
'./src/assets/css/map-fix.css',
6+
'./src/assets/css/spacing.css',
7+
'./src/assets/css/service-cards.css',
8+
'./src/assets/css/meanmenu.min.css'
9+
],
10+
safelist: [
11+
'info-open',
12+
'overlay-open',
13+
'offcanvas-opened',
14+
'opened',
15+
'sticky',
16+
'show',
17+
'active-progress',
18+
'tp-currency-list-open',
19+
'tp-setting-list-open',
20+
'body-overlay',
21+
'dropdown-opened',
22+
'meanmenu-reveal',
23+
'mean-container',
24+
'mean-bar',
25+
'mean-nav',
26+
'mean-expand',
27+
'mean-clicked',
28+
'mean-push',
29+
'mean-remove',
30+
'meanclose',
31+
'swiper-slide-active',
32+
'swiper-slide-next',
33+
'swiper-slide-prev',
34+
'swiper-slide-duplicate',
35+
'swiper-slide-visible',
36+
'swiper-button-next',
37+
'swiper-button-prev',
38+
'swiper-pagination-bullet',
39+
'swiper-pagination-bullet-active',
40+
'swiper-pagination-bullets',
41+
'swiper-pagination-horizontal',
42+
'embedded-map',
43+
'custom-popup',
44+
'aos-init',
45+
'aos-animate',
46+
'animated',
47+
'active',
48+
'mean-last',
49+
'hidden'
50+
],
51+
output: './src/assets/css/purged/'
52+
};

0 commit comments

Comments
 (0)