Website analytics

With your consent, Yandex Metrica collects information about visits and interactions. We also link the most recently opened resource to your request. This helps improve the website. Forms and content work with either choice.

Your choice is saved for 180 days. You can change it in the page footer. About your data

Home

Case study · CoreWeb studio website

CoreWeb: Nuxt, BEM and Sass in practice

How we refactored our Nuxt and Vue website: component boundaries, forms, BEM, Sass and on-demand tools. Source code and JavaScript measurements.

Published: Updated:

Our scope of work

  • Splitting pages into components and extracting form workflows
  • Moving authored styles to SCSS with enforced BEM naming
  • Loading 15 tools on demand
  • Fixing animation lifecycles, focus and video seeking
  • Comparing builds, browser testing and production delivery

This is our own website. On the homepage, we present our services and work. In the resource sections, we help visitors prepare a project: write a brief, compare supplier proposals and plan a website migration. By November 2026, the project contained 135 public routes and 15 interactive tools.

We reworked the architecture while preserving the existing design, copy and visitor workflows. The three tools we measured loaded 24.6–26.1% less JavaScript. The homepage loaded 0.5% more. This case study explains the changes, shows excerpts from the released code and records the conditions behind those figures.

CoreWeb homepage hero with loaded 3D graphics, the website offer and buttons to discuss a project or view the work

The homepage captured in a regular browser on 15 November 2026, with fonts and animated 3D graphics loaded. The refactor preserved its visual language: large typography, contrasting sections and prominent actions. The archived 13 November screenshot remains available separately; the historical measurement conditions are recorded below.

The task: maintain several kinds of pages

Visitors can read about a service and send an enquiry, explore a case study, search the knowledge base or prepare a document in a tool. Each workflow has its own data and states: validation errors, JSON imports, manual edits, downloads, language choices and analytics consent.

When reviewing our own implementation, we found repeated download code, large components mixing different responsibilities and editors loading on routes that did not need them. We also reproduced functional defects. The article listing passed a component instance to an animation that expected a DOM element. The server returned whole videos even when the browser requested a byte range, causing seeking to jump back to the start.

We set concrete constraints for the refactor: preserve copy and the geometry of key sections, server-rendered HTML, localised URLs, forms and document exports. We saved the baseline build and screenshots before comparing them with the result.

Architecture: a clear responsibility for each layer

The site uses Nuxt 4, Vue 3 and TypeScript. Nuxt Content stores articles and case studies in Markdown. The server renders page content and metadata together. Russian and English pages share components; the document preparation tools are available in Russian.

The brief editor illustrates the boundaries. The route selects the content and tool. A component renders the interface. A composable owns state and workflows. Plain functions validate data and build the document.

Inside the website brief editor
  1. Routeapp/pages/tools/[slug].vue

    Loads content, checks toolId and sets page metadata.

  2. ComponentWebsiteBriefBuilder.vue

    Renders fields, errors, the preview and actions.

  3. State and workflowsuseWebsiteBrief.ts

    Owns answers, imports, replacement undo and downloads.

  4. Data rulesshared/utils/website-brief.ts · brief-file.ts

    Validates JSON and builds the document with plain functions.

The brief is generated in the browser. Sending an enquiry is a separate workflow: LeadForm → useLeadForm → server-side CRM relay.

This makes JSON imports testable without starting Vue. Fields can move without relocating validation rules into the template, and the enquiry endpoint can be tested separately. Small local states remain in their components; extraction is useful when it creates a meaningful boundary.

Components organised around sections

We extracted 17 components for homepage sections, services and pricing, enquiry preparation and the shared resource layout. There were 54 Vue components at release. This records the structure of the project; a component count alone does not measure architecture quality.

ConversionStory.vue now assembles the required part of the page from four sections. Russian and English copy lives in a typed dictionary, while each section owns its markup and styles. This is the complete component from revision 0864754f.

app/components/ConversionStory.vuevue
<template>
  <div class="story">
    <HomeSituationsSection v-if="part === 'decision'" :copy="copy.situations" />

    <HomeMethodSection v-if="part === 'decision'" :copy="copy.method" />

    <HomeProcessSection v-if="part === 'delivery'" :copy="copy.process" />

    <HomeFaqSection v-if="part === 'delivery'" :copy="copy.faq" />
  </div>
</template>

<script setup lang="ts">
import { conversionStoryCopy } from '~/data/conversion-story';
withDefaults(defineProps<{ part?: 'decision' | 'delivery' }>(), { part: 'decision' });
const { locale } = useI18n();
const copy = computed(() => conversionStoryCopy[locale.value === 'ru' ? 'ru' : 'en']);
</script>

We moved the state of six complex forms into composables: the brief, website acceptance checklist, proposal comparison, content readiness, migration planner and enquiry form. For the brief editor, that includes an import preview, undoing a replacement and protecting manual edits from accidental overwrites.

BEM and Sass: shared rules with local styling

We moved all authored styles to SCSS. Sass Embedded compiles modules using @use; CSS custom properties retain the shared colours, typography and spacing. A standalone component usually keeps its styles beside the template in a scoped style block.

Class names follow block__element--modifier. For example, access is the access matrix editor, access__textarea is one of its fields and dropdown__option--selected is a selected dropdown option. Names identify the interface that owns an element. Stylelint checks naming and disallows ID selectors in components and page styles. IDs remain available for anchors and form fields.

We collected repeated field declarations in a Sass mixin: dimensions, spacing, background and typography. The selector remains local to the tool.

app/assets/scss/_tool-controls.scssscss
@mixin control {
  display: block;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  padding: 0.75rem;
  background: var(--black-2);
  color: var(--white);
  border: 1px solid #8b8e96;
  font: inherit;
  line-height: 1.5;
}

AccessMatrixEditor.vue loads this module with @use '~/assets/scss/tool-controls';. Its input, select and textarea share the same foundation through one inclusion:

app/components/AccessMatrixEditor.vuescss
.access__input,
.access__select,

The mixin does not create a global rule for every input on the site. Element selectors remain in the document foundation and Markdown typography within the named knowledge block, where ContentRenderer generates the elements.

Loading tools by route

Tool pages share a template, but a visitor needs a particular editor. We introduced one registry of 15 allowed identifiers and asynchronous components. It defines loading boundaries and limits selection to known tools.

The beginning of the registry shows the first three editors. The remaining entries follow the same pattern; this excerpt ends at an entry boundary.

app/utils/tool-components.tsts
import { defineAsyncComponent, type Component } from 'vue';

/** One registry is both the route allowlist and the lazy component boundary. */
const toolComponents: Record<string, Component> = {
  'website-brief': defineAsyncComponent(() => import('~/components/WebsiteBriefBuilder.vue')),
  'website-acceptance': defineAsyncComponent(
    () => import('~/components/WebsiteAcceptanceChecklist.vue'),
  ),
  'proposal-comparison': defineAsyncComponent(() => import('~/components/ProposalComparison.vue')),

The route passes toolId to the resolver below. An unknown identifier cannot select an arbitrary file; the page returns 404. The selected component still renders its content on the server.

app/utils/tool-components.tsts
export function getToolComponent(id: string | undefined): Component | undefined {
  return id && Object.hasOwn(toolComponents, id) ? toolComponents[id] : undefined;
}

The change in loaded JavaScript

We compared local builds before and after the refactor. Every route opened in a fresh Chrome context through Playwright, at 1440 × 1000, with reduced motion enabled, no interface interaction and external requests blocked. After networkidle, we waited another 500 ms and added the decoded sizes of JavaScript responses. We ran each route twice and got identical values.

Loaded JavaScript · decoded bytes

A shared scale starting at zero. Both runs per route returned identical values. Local builds measured on 13 November 2026.

The brief editor loaded 202,431 fewer bytes, proposal comparison 199,846 fewer and the migration planner 199,601 fewer. These three routes show the effect of separating editors. The homepage gained 2,701 bytes and three JavaScript chunk requests, so this measurement does not establish a homepage speed improvement.

These are code volumes for a specific loading scenario. They are not compressed transfer sizes, load times, INP, field Core Web Vitals or conversion measurements. Reduced-motion runs also do not measure the cost of the full animation experience. The figures, request counts and conditions are available in the measurement data JSON. The measurements were recorded on 13 November 2026, before this case study page was added.

Shared actions: one document download helper

Creating a Blob URL, attaching a temporary link and triggering a download was repeated in 18 places. We kept the document format, filename and analytics in each tool and moved the browser mechanics into downloadBlob.

app/utils/download.tsts
/** Trigger a user-requested local download without retaining a detached object URL. */
export function downloadBlob(blob: Blob, filename: string): void {
  const url = URL.createObjectURL(blob);
  const anchor = document.createElement('a');
  try {
    anchor.href = url;
    anchor.download = filename;
    anchor.hidden = true;
    document.body.append(anchor);
    anchor.click();
  } finally {
    anchor.remove();
    // Browsers consume the URL asynchronously after the click, including large exports.
    setTimeout(() => URL.revokeObjectURL(url), 1000);
  }
}

The finally block removes the temporary link even if the click throws. The URL is released after a delay because the browser may start reading it after the click handler. Resource cleanup has regression coverage. Visitors receive the same document, filename and encoding.

Fixes exercised in the browser

Animation lifecycle

Animations load asynchronously. While loading, a visitor may leave the page or enable reduced motion. useGsapContext checks the request generation before creating a context, reverts the previous context and removes listeners on unmount. Smooth scrolling follows the same ownership rule: the application shell owns the instance and coordinates repeated starts.

Our article listing had a separate issue: a template ref on NuxtLink returned a Vue component instance, while ScrollTrigger needed a DOM element. We fixed the link selection inside the section’s root and checked navigation through the listing and resource pages with a browser scenario.

Video, keyboard and focus

We added a single HTTP byte-range handler with 206 responses for requested video segments and 416 for unsatisfiable ranges, including If-Range handling. Seeking worked again at the existing URLs. In our implementation, Nitro 2 still reads the whole file into memory. The fix limits the response to the selected range but does not reduce server-side file reading.

We added Arrow/Home/End controls, accessible timeline labels, an independent scroll lock and focus restoration to the player. We restored focus to the first invalid enquiry field and added a retry for analytics loading on a later focus reconciliation, while preserving the user’s consent requirement.

Release verification

These results belong to the refactor released on 13 November 2026 at revision 0864754f. They were recorded before publishing this case study.

CheckResult
Formatting, Oxlint, ESLint, Stylelint, TypeScript and production buildpnpm verify completed successfully
Data rules and server workflows214 unit and 5 integration tests
Navigation, forms, imports/exports, analytics, motion and video19 browser suites passed in CI
Routes and responsive layouts135 routes at 320, 360, 390, 768, 1024 and 1440 px
Interface preservationCopy, heading geometry and control counts matched; no horizontal page overflow
Visual comparison270 full-page before/after screenshots, reduced-image comparison and inspection of key pages
After deployment135 pages, 6,211 links and 3,149 fragments passed checks; videos returned the requested bytes

Browser suites run in CI with bounded execution times. Form checks use local receivers or intercepted responses. No synthetic enquiries were sent to the production CRM, and no test events were sent to the external analytics counter.

What the project gained

Site sections now have explicit owners in the code. Forms can evolve through composables and testable functions; tool styles use local BEM blocks and shared Sass modules. A new editor needs its component, a registry entry and published content with a valid toolId. Existing workflows remain covered by regression checks.

For further performance measurements, we need to target specific user actions and network conditions, including the full animation experience. Here, we measured reduced code loading for three tools and verified the functional fixes. We did not measure enquiry growth, search rankings or complete accessibility certification with these checks.

Discuss your project

Describe your goals, constraints and required outcome. We will define the scope for your project separately.