A demo of Parcel with Sass och Typescript. Made for students at vocational university studying front-end on their second semester of four.
- First clone repo to local machine
git clone https://github.com/niklas-mardby/pink-circle.git
- Enter repo directory
cd pink-circle
- Install dev dependencies
npm install
- Start the dev server that will watch for saved changes to your SCSS-files and TS-files
npm run start
- Now open http://localhost:1234/ in your browser. The dev server is running and you can code Sass and TS, save and then watch the result in your browser without having to compile or refresh.
If you want to start your own project working with Parcel, Sass and Typescript you set it up like this:
First install Sass and Typescript globally, then
- Create repo on Github with a readme
- Clone repo to local computer and enter folder of repo
- Run
npm init
- Run
npm install --save-dev parcel
and make sure your package.json has these lines:
"source": "src/index.html",
"scripts": {
"start": "parcel"
},
โญ My package.json currently looks like this: https://github.com/niklas-mardby/pink-circle/blob/main/package.json and yours can look the same.
- Create a .gitignore file and add
node_modules
dist
.parcel-cache
-
Now create the files and folders for your project! Create a folder src and in there create an index.html
-
You can link your html directly to your Sass and TS like so
<script defer src="ts/app.ts"></script>
<link rel="stylesheet" href="scss/main.scss">
-
Which also means you need a folder scss with a main.scss and a folder ts with an app.ts (all of which are added to folder src)
-
Now you are set up and you can start the dev server and start working with watch and auto-refresh
npm run start
- Now open http://localhost:1234/ in your browser
There are more things that could be added. Come with suggestions!
Known issues are:
- Readme lacks instructions on how to build project