<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Nurlan TL</title>
    <description>The latest articles on DEV Community by Nurlan TL (@nurlan_tl).</description>
    <link>https://dev.to/nurlan_tl</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F978513%2Fcef331ae-c43a-4a2c-9fea-44cd1b2728b2.png</url>
      <title>DEV Community: Nurlan TL</title>
      <link>https://dev.to/nurlan_tl</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/nurlan_tl"/>
    <language>en</language>
    <item>
      <title>GitHub Newbie - First repo roadmap (Nuxt 3)</title>
      <dc:creator>Nurlan TL</dc:creator>
      <pubDate>Sat, 30 Mar 2024 18:32:23 +0000</pubDate>
      <link>https://dev.to/nurlan_tl/github-newbie-first-repo-roadmap-nuxt-3-31ki</link>
      <guid>https://dev.to/nurlan_tl/github-newbie-first-repo-roadmap-nuxt-3-31ki</guid>
      <description>&lt;p&gt;Sample workflow to create Nuxt 3 project and its repository on GitHub and listing necessary git operations to start working in a git way.&lt;/p&gt;

&lt;p&gt;Prerequisites: GitHub account, git installed locally, terminal, VSCode&lt;/p&gt;

&lt;h2&gt;
  
  
  Preparation
&lt;/h2&gt;

&lt;p&gt;Create repository My-repo on GitHub.com. This will create new repository with README.md file and if necessary LICENSE file inside.&lt;/p&gt;

&lt;p&gt;Open terminal and cd to the folder containing your projects, for example My-projects folder.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;cd My-projects
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Clone remote repository to local machine using the web URL. Get this url on repositories GitHub page (code/local/HTTPS). It looks like &lt;code&gt;https://github.com/MyName/My-repo.git&lt;/code&gt;. Go to local terminal and:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git clone https://github.com/MyName/My-repo.git
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This will create My-repo folder inside My-projects folder.&lt;/p&gt;

&lt;p&gt;Next initialize our Nuxt 3 (or any other framework) you want:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;npx nuxi@latest init My-repo --force
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;--force option&lt;/code&gt; is to use existing folder.&lt;/p&gt;

&lt;p&gt;Don't forget to refuse initializing repository as we already done that.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;✔ Initialize git repository?
No
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Initializing Nuxt 3 creates all necessary files for default Nuxt project. Also Nuxt changes README.md file, and makes no changes to LICENSE file if it exists.&lt;/p&gt;

&lt;p&gt;Perfect time to open this My-repo folder in &lt;strong&gt;VSCode&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Open VSCode integrated terminal. All commands to be run in my-projects/My-repo folder.&lt;/p&gt;

&lt;p&gt;Now we have Remote Repository: The remote repository is the repository hosted on the Git server (e.g., GitHub). When you create a repository on the server, it becomes the remote repository. This repository contains the entire history of the project and serves as the central repository that multiple developers can collaborate on.&lt;/p&gt;

&lt;p&gt;And we have Local Repository: The local repository is the copy of the repository that resides on your local machine. When you clone a repository from the remote server, Git creates a local copy of the entire repository, including all branches, commits, and files. This local repository is where you do your work and make changes to the project.&lt;/p&gt;

&lt;p&gt;There is also .gitignore file which specifies intentionally untracked files that Git should ignore. This allows you to avoid cluttering your repository with files that are generated during the development process, such as compiled binaries, log files, and dependencies.&lt;/p&gt;

&lt;p&gt;We done with preparation steps.&lt;/p&gt;

&lt;h2&gt;
  
  
  Git starting kit
&lt;/h2&gt;

&lt;p&gt;Commands to know:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git status
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The git status command is used to display the current state of the repository, including information about tracked and untracked files, changes that have been staged or not staged for commit, and the branch you're currently on.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git branch
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Running this command without any additional arguments will list all the local branches in your repository. The currently checked out branch will be indicated with an asterisk &lt;code&gt;(*)&lt;/code&gt; next to its name.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git branch -a
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This will list both local and remote branches. Remote branches are prefixed with the name of the remote repository (e.g., origin/main, origin/feature-branch).:&lt;br&gt;
&lt;code&gt;* main&lt;/code&gt;&lt;br&gt;
&lt;code&gt;remotes/origin/HEAD -&amp;gt; origin/main&lt;/code&gt;&lt;br&gt;
&lt;code&gt;remotes/origin/main&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git branch --show-current
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This command will display the name of the local branch that you are currently on:&lt;br&gt;
&lt;code&gt;main&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git remote show origin
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This command will display detailed information about the remote repository, including the default branch and its name. If the default branch is "main", then your local "main" branch is indeed the same as the "main" branch on the remote repository:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;* remote origin&lt;/code&gt;&lt;br&gt;
&lt;code&gt;Fetch URL: https://github.com/MyName/My-repo.git&lt;/code&gt;&lt;br&gt;
&lt;code&gt;Push  URL: https://github.com/MyName/My-repo.git&lt;/code&gt;&lt;br&gt;
&lt;code&gt;HEAD branch: main&lt;/code&gt;&lt;br&gt;
&lt;code&gt;Remote branch:&lt;/code&gt;&lt;br&gt;
&lt;code&gt;main tracked&lt;/code&gt;&lt;br&gt;
&lt;code&gt;Local branch configured for 'git pull':&lt;/code&gt;&lt;br&gt;
&lt;code&gt;main merges with remote main&lt;/code&gt;&lt;br&gt;
&lt;code&gt;Local ref configured for 'git push':&lt;/code&gt;&lt;br&gt;
&lt;code&gt;main pushes to main (fast-forwardable)&lt;/code&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  Authenticate
&lt;/h2&gt;

&lt;p&gt;To work with remote branch we need to authenticate your GitHub account when attempting to push changes to the remote repository. Simplest way to do it is to create a personal access token in your GitHub account settings and use the token to access GitHub adding it to your existing remote URL.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git remote set-url origin https://TOKEN@github.com/MyName/My-repo.git
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This will add TOKEN to your remote repository URL and you can work with GitHub.&lt;/p&gt;

&lt;h2&gt;
  
  
  Commit and push
&lt;/h2&gt;

&lt;p&gt;Now we need to commit and push our initial Nuxt setup to local repository. First add newly created files to repository:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git add .
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then we commit changes to local repo:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git commit -m "Initiating Nuxt project"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now our local repository contains all our changes.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git push origin main:main
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Thats all initial steps. Now we can see our Nuxt files on GitHab.com. We have one main branch on remote repo and one main branch on local repo.&lt;/p&gt;

&lt;h2&gt;
  
  
  Branch
&lt;/h2&gt;

&lt;p&gt;It is time to make some changes to the project: clearing sample files and configuring project. We now create branch for our changes.&lt;/p&gt;

&lt;p&gt;Before creating a new branch, it's a good idea to ensure that your local "main" branch is up-to-date with the remote "main" branch. You can do this by pulling any changes from the remote repository:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git pull origin main
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Next, create a new branch for the task of clearing the initial sample files and configuring. You can do this using the following command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git checkout -b clear-and-config
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;Switched to a new branch 'clear-and-config'&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Now we can see our status:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git status
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;On branch clear-and-config&lt;/code&gt;&lt;br&gt;
&lt;code&gt;nothing to commit, working tree clean&lt;/code&gt;&lt;br&gt;
&lt;code&gt;admin@iMac My-repo % git branch&lt;/code&gt;&lt;br&gt;
&lt;code&gt;* clear-and-config&lt;/code&gt;&lt;br&gt;
&lt;code&gt;main&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;And here we can start working with code. As intended we cleared initial files and make configuration changes.&lt;/p&gt;

&lt;p&gt;After that:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git add .
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git commit -m "Clear initial sample files and configuring"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git push -u origin clear-and-config
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You are pushing the new branch named "clear-and-config" to the remote repository named "origin". This command does not affect the "main" branch on the remote repository.&lt;/p&gt;

&lt;p&gt;The &lt;code&gt;-u&lt;/code&gt; option, short for &lt;code&gt;--set-upstream&lt;/code&gt;, tells Git to set up tracking between the local branch and the remote branch. This means that future git pull and git push commands will automatically know where to pull from and push to without needing to specify the remote and branch explicitly.&lt;/p&gt;

&lt;p&gt;New branch "clear-and-config" will be created on the remote repository (if it doesn't already exist) and set up to track the local branch. This means that any future pushes from the local "clear-and-config" branch will be directed to the corresponding branch on the remote repository.&lt;/p&gt;

&lt;p&gt;You don't need to create a remote "clear-and-config" branch separately. Git handles the creation of the remote branch for you when you push the local branch for the first time.&lt;/p&gt;

&lt;h2&gt;
  
  
  Merge or rebase
&lt;/h2&gt;

&lt;p&gt;Once your changes are ready to be integrated into the main branch, you can merge them using &lt;code&gt;git merge&lt;/code&gt; or rebase them using &lt;code&gt;git rebase&lt;/code&gt;, depending on your preferred workflow and the requirements of your project.&lt;/p&gt;

&lt;h2&gt;
  
  
  Merge
&lt;/h2&gt;

&lt;p&gt;First, switch to the branch you want to merge changes into. For example, if you want to merge changes into the "main" branch:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git checkout main
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Next, merge the changes from the feature branch (in this case, "clear-and-config") into the main branch:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git merge clear-and-config
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If Git detects any conflicts between the changes in the two branches, it will pause the merge process and ask you to resolve the conflicts manually. You can use a text editor or a merge tool to resolve conflicts.&lt;/p&gt;

&lt;p&gt;Push Changes :&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git push origin main
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;After completing these steps, the changes from your feature branch will be merged into the main branch, and both branches will be up-to-date with each other.&lt;/p&gt;

&lt;h2&gt;
  
  
  Rebase
&lt;/h2&gt;

&lt;p&gt;Git rebase is another way to integrate changes from one branch into another, similar to merging. However, it operates differently under the hood and can result in a cleaner, more linear history compared to merging.&lt;/p&gt;

&lt;p&gt;When you rebase a branch onto another branch, Git takes the entire series of commits from the branch being rebased and "replays" them on top of the target branch. This essentially rewrites the commit history of the rebased branch, making it appear as if the changes were made directly on top of the target branch.&lt;/p&gt;

&lt;p&gt;Switch to the branch you want to rebase. For example, if you want to rebase the "clear-and-config" branch onto the "main" branch:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git checkout clear-and-config
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Rebase onto the Target Branch:&lt;br&gt;
Next, rebase the current branch onto the target branch (e.g., "main"):&lt;/p&gt;

&lt;p&gt;bash&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git rebase main
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Resolve any Rebase Conflicts (if necessary):&lt;br&gt;
Similar to merging, if Git encounters any conflicts during the rebase process, it will pause and ask you to resolve them manually.&lt;/p&gt;

&lt;p&gt;Continue the Rebase:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git rebase --continue
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;After resolving conflicts, you can continue the rebase by using &lt;code&gt;git rebase --continue&lt;/code&gt;. If you encounter any conflicts during the rebase, you'll need to resolve them and continue the process until all commits have been replayed.&lt;/p&gt;

&lt;p&gt;The rebase operation modifies the commit history of the clear-and-config branch locally. It takes the commits from the clear-and-config branch and replays them on top of the main branch, essentially rewriting the commit history of the clear-and-config branch.&lt;/p&gt;

&lt;p&gt;The main branch on your local machine remains unchanged during the rebase operation. The changes from the clear-and-config branch are applied on top of the main branch, but the main branch itself does not undergo any direct modifications.&lt;/p&gt;

&lt;p&gt;After completing the rebase locally and resolving any conflicts, you push the changes from the clear-and-config branch to the remote repository. This updates the clear-and-config branch on the remote repository with the rebased commits, effectively incorporating them into the commit history of the main branch on the remote repository.&lt;/p&gt;

&lt;p&gt;In summary, the rebase operation affects the commit history of the clear-and-config branch locally, while the main branch remains unaffected until you push the changes to the remote repository.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git push origin clear-and-config --force
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This command will update the remote clear-and-config branch with the rebased commits, incorporating them into the commit history of the main branch on the remote repository.&lt;/p&gt;

&lt;p&gt;It's important to use the --force option when pushing after a rebase to overwrite the existing history of the remote branch with the rewritten history resulting from the rebase. However, use force-push with caution, especially if others are working with the same branch, as it can cause confusion and potentially overwrite their work.&lt;/p&gt;

&lt;h2&gt;
  
  
  Final
&lt;/h2&gt;

&lt;p&gt;That is it. It is very simplified workflow for single developer who don't change main until feature branch is done and merged into main. For complex scenarios read more. Good luck.&lt;/p&gt;

</description>
      <category>github</category>
      <category>nuxt</category>
      <category>newbie</category>
    </item>
    <item>
      <title>Tips to create Web components using Vue 3, TS, Vite.</title>
      <dc:creator>Nurlan TL</dc:creator>
      <pubDate>Sat, 10 Dec 2022 19:48:26 +0000</pubDate>
      <link>https://dev.to/nurlan_tl/tips-to-create-web-components-using-vue-3-ts-vite-3a7a</link>
      <guid>https://dev.to/nurlan_tl/tips-to-create-web-components-using-vue-3-ts-vite-3a7a</guid>
      <description>&lt;p&gt;Recently I had a task to create a Web Component. My favorite framework is Vue 3 and I had no intentions to use another. At first glance there are a lot of videos and articles how to do it but some of them use slightly different stack and others give only part of info I needed. Finally I managed to do it and now want to share my experience.&lt;/p&gt;

&lt;p&gt;Install Vite with Vue latest and TS support.&lt;/p&gt;

&lt;p&gt;Create Vue SFC component to be your web component, its name should have &lt;strong&gt;ce.vue&lt;/strong&gt; extension:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;SampleSimple.ce.vue&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;We can use it inside our &lt;strong&gt;App.vue&lt;/strong&gt; as any other components. And it will help us to test and debug it on developer server:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;npm run dev&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;You implement the logic you want inside this &lt;strong&gt;SampleSimple.ce.vue&lt;/strong&gt; and place any other components inside. You don't need to name child components with &lt;strong&gt;ce.vue&lt;/strong&gt; extension, just usual &lt;strong&gt;vue&lt;/strong&gt; extension.&lt;/p&gt;

&lt;p&gt;Lets move to creating final web component from you vue component. First of all we need to create second main.ts file whose job is to generate final web components js file. As you can imagine its name will be:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;main.ce.ts&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import { defineCustomElement } from 'vue'
import SimpleSampleComponent from './SimpleSample.ce.vue'

const SimpleSample = defineCustomElement(SimpleSampleComponent)

customElements.define('simple-sample', SimpleSample)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Our script part of package.json needs no changes:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;  "scripts": {
    "dev": "vite",
    "build": "vue-tsc --noEmit &amp;amp;&amp;amp; vite build",
    "preview": "vite preview"
  }
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The most important part is vite.config.ts:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'

export default defineConfig({
  plugins: [
    vue({
      template: {
        compilerOptions: {
          isCustomElement: (tag) =&amp;gt; tag.includes('simple-sample')
        }
      }
    })
  ],
  build: {
    lib: {
      entry: './src/main.ce.ts',
      name: 'simple-sample',
      // the proper extensions will be added
      fileName: 'simple-sample'
    }
  },
  define: {
    'process.env': process.env
  }
})
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;We have changed &lt;strong&gt;build&lt;/strong&gt; part, added define for &lt;strong&gt;process.env&lt;/strong&gt;, and added vue &lt;strong&gt;compilerOptions&lt;/strong&gt; &lt;strong&gt;isCustomElement&lt;/strong&gt; to distinguish our custom element. &lt;/p&gt;

&lt;p&gt;Thats all. Now run:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;npm run build&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;and that will put &lt;strong&gt;simple-sample.js&lt;/strong&gt; and &lt;strong&gt;simple-sample.umd.cjs&lt;/strong&gt; files into &lt;strong&gt;dist&lt;/strong&gt; folder.&lt;/p&gt;

&lt;p&gt;To use our new web component you can put &lt;strong&gt;simple-sample.js&lt;/strong&gt; to any place you want. Then add&lt;/p&gt;

&lt;p&gt;&lt;code&gt;&amp;lt;script src="path/to/simple-sample.js"&amp;gt;&amp;lt;/script&amp;gt;&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;to html header and use your component like that:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;&amp;lt;simple-sample&amp;gt;&amp;lt;/simple-sample&amp;gt;&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;If you defined properties inside your &lt;strong&gt;SimpleSample.ce.vue&lt;/strong&gt; you add properties too:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;&amp;lt;simple-sample property1="value"&amp;gt;&amp;lt;/simple-sample&amp;gt;&lt;/code&gt;   &lt;/p&gt;

&lt;p&gt;What about styles? Styles that are inside SimpleSample.se.vue are included into resulting web component:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;script setup lang="ts"&amp;gt;
...
&amp;lt;/script&amp;gt;
&amp;lt;template&amp;gt;
  ...
&amp;lt;/template&amp;gt;
&amp;lt;style&amp;gt;
// our web component styles
&amp;lt;/style&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If you import styles inside script part of the component they will be ignored by Vite build process. So the only place is &lt;strong&gt;styles&lt;/strong&gt; part of SFC.  Thats ok if your styles are small but if there are a lot of lines it is not comfortable to work with. So there is a solution - &lt;strong&gt;scss&lt;/strong&gt;. We can use scss &lt;strong&gt;import&lt;/strong&gt; and move styles to another directory and organize them in more smart manner:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;script setup lang="ts"&amp;gt;
...
&amp;lt;/script&amp;gt;
&amp;lt;template&amp;gt;
  ...
&amp;lt;/template&amp;gt;
&amp;lt;style lang="scss"&amp;gt;
@import '../scss/file1';
@import '../scss/file2';
@import '../scss/file3';
&amp;lt;/style&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Thats all. I hope this info will be helpfull.&lt;/p&gt;

</description>
      <category>vue</category>
      <category>vite</category>
      <category>webcomponents</category>
      <category>tutorial</category>
    </item>
  </channel>
</rss>
