SharePoint SPFx
Introduction
What is SPFx?
1. SPFx is SharePoint Framework Extension which was newly
introduced in SharePoint 2016 Online.
2. SPFx is introduced on replacement of SharePoint Visual
Web Parts(SP Visual Web Parts can't be deployed to SharePoint Online).
3. In SPFx we can 3 types of solutions like Web Part,
Extensions and Library.
Why SPFx?
1. The world is moving more and more towards client-side development.
No matter how good the back-end architecture is, what the user gets to see is
user interface. If the user doesn't feel a smooth and lag free experience, user
would certainly complain.
2. With these advancements in technologies, SharePoint has
decided to focus more towards improving the user experience with the product. So,
this opens a world of endless possibilities for developers working with
SharePoint. This means Microsoft SharePoint now has full support for open
source tool chain.
Configuring
Development Environment
1.
Install Supportable Node JS Version
If
you are in Windows, you can use the msi installers in this link for the easiest
way to set up NodeJS. If you have NodeJS already installed, check if you have
the latest version by using node -v. It should return the current LTS version.
2.
Install Yeoman and
gulp
To
install Yeoman and gulp open the Node js prompt in administrator mode and run
the below command (Please run the Proxy commands in case below command not
executes properly).
npm install -g yo gulp
a. What
is Yeoman & What it will do?
Yeoman
is an open source client-side scaffolding tool for web applications. Yeoman
runs as a command-line interface written for Node.js and combines several
functions into one place, such as generating a starter template, managing
dependencies, running unit tests, providing a local development server, and optimizing
production code for deployment.
b. What
is gulp & What it will do?
Gulp
is a cross-platform, streaming task runner that lets developers automate many
development tasks. At a high level, gulp reads files as streams and pipes the
streams to different tasks. These tasks are code-based and use plugins. The
tasks modify the files, building source files into production files.
3.
Install Yeoman SharePoint
generator template
a. The
Yeoman SharePoint web part generator helps you quickly create a SharePoint
client-side solution project with the right toolchain and project structure.
To install the SharePoint Framework Yeoman generator globally, enter the
following command in Node JS Command Prompt:
npm
i -g @microsoft/generator-sharepoint
b. If
you need to switch between the different projects created by using different
versions of the SharePoint Framework Yeoman generator, you can install the
generator locally as a development dependency in the project folder by
executing the following command in PowerShell:
npm
install @microsoft/generator-sharepoint –save-dev
Once you are done with the installation, you
will be able to create new webparts using SharePoint framework.
4.
Install a Code Editor
You can use any code
editor or IDE that supports client-side development to build your web part,
such as:
The steps and
examples in this documentation use Visual Studio Code, but you can equally use any editor of your
choice.
5.
How to create New SharePoint SPFx Project
a.
Open Node JS as administrator
b. Create
a directory to store the files by running the following command
md <folder name>
c.
Navigate to the new Folder
cd
.\<folder name>\
d.
Navigate to newly created folder to create the
SPFx project
e.
Run the below command to create New SPFx Project
yo @microsoft/sharepoint
f. This will request a couple of details, enter
all of those, and that will create the new project for you.
i. What is the name of your project?
ii. What
is the SharePoint version?
iii. Select
if the admin should have the option to deploy this app to all site or not.
iv. Select the type of client-side component.
v. Enter
the webpart name & Enter the webpart description
vi. After
the configuration, there is a confirmation message like the following.
vii. Select the framework of the webpart, this is
just for scaffolding purpose
Sharing is caring.... Enjoy SharePoint Coding.....
Comments
Post a Comment