Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Doc] Getting started with sass #732

Open
ggomarighetti opened this issue Jan 12, 2024 · 1 comment
Open

[Doc] Getting started with sass #732

ggomarighetti opened this issue Jan 12, 2024 · 1 comment
Assignees

Comments

@ggomarighetti
Copy link

ggomarighetti commented Jan 12, 2024

Hi, it would be nice to add to the main website, a guide on how to start a project by compiling the Bootstrap scss/sass files to customize them.

This way we only need two files in our app.razor, and they would be both locally, without the need to instantiate the cdn, at the same time we can customize it as much as we want.

I attach my files to do it, and a link to the official bootstrap guide, I hope I can make a pull request and send it with the changes in the documentation, or if someone can before, better.

Greetings.

bootstrap.scss

@import "../node_modules/bootstrap/scss/bootstrap";
@import url("../wwwroot/_content/Havit.Blazor.Components.Web.Bootstrap/defaults.css");

package.json

{
  "dependencies": {
    "bootstrap": "^5.3.2"
  },
  "devDependencies": {
    "copyfiles": "^2.4.1",
    "sass": "^1.69.7"
  },
  "scripts": {
    "bs-bundle": "copyfiles -f node_modules/bootstrap/dist/js/bootstrap.bundle.min.* wwwroot/bootstrap/js",
    "bs-theme": "sass --style=compressed Theme/bootstrap.scss:wwwroot/bootstrap/css/bootstrap.min.css"
  }
}

app.csproj

<Project Sdk="Microsoft.NET.Sdk.Web">

    <PropertyGroup>
        <TargetFramework>net8.0</TargetFramework>
        <Nullable>enable</Nullable>
        <ImplicitUsings>enable</ImplicitUsings>
    </PropertyGroup>

    <ItemGroup>
      <_ContentIncludedByDefault Remove="wwwroot\bootstrap\bootstrap.min.css" />
      <_ContentIncludedByDefault Remove="wwwroot\bootstrap\bootstrap.min.css.map" />
    </ItemGroup>

    <ItemGroup>
      <PackageReference Include="Havit.Blazor.Components.Web.Bootstrap" Version="4.4.2-pre2" />
    </ItemGroup>

    <Target Name="Bootstrap" BeforeTargets="BeforeBuild">
        <Exec Command="npm install"/>
        <Exec Command="npm run bs-bundle"/>
        <Exec Command="npm run bs-theme"/>
    </Target>

</Project>
@hakenr
Copy link
Member

hakenr commented Jan 13, 2024

@crdo Please take a look. This might fit into the "Concepts" section of our doc, maybe a part of the (currently not existing) "Customization" page?

@crdo crdo self-assigned this Mar 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants