Jan 31 2017 05:43 AM
Jan 31 2017 05:43 AM
We are evaluating if we create a visual webpart, will we be able to make it responsive as well? Considering we manage to create a custom master page and custom pagelayout that has RWD framework maybe Bootstrap.
Can we achieve this in a visual webpart or do we have mandatorily go with add-in model or just use Cotent Editor webparts?
Jan 31 2017 10:55 AM
Jan 31 2017 06:59 PM
Yes, correct. However, deploying all of these (HTML/CSS/JS) in different environments and stages when using Script Editor Webpart and then creating a page with the Script editor webpart and linked to the respective HTML/CSS/JS is something that I am not clear on. Any thoughts on this?
We would not want to do it manually in all the different environments.
Jan 31 2017 10:58 PM
Jan 31 2017 11:32 PM
Feb 01 2017 04:16 AM - edited Feb 01 2017 04:21 AMSolution
Hi @Devendra Singh,
I would not recommend using visual web part at all for this kind of things. Sometimes it's harder, sometimes impossible (in SPO). I know that this recommendation is mentioned before. Just telling it again.
I would recommend using CEWP instead with a link to html hosted in SharePoint _catalogs/masterpage document library.
cewp.html acts as a container for your JS/HTML/web part's DOM, etc.
The web part communicates with SharePoint object model via JSOM or REST or SOAP (yes there are some things missing in other object models), depending on your preferences and functionality.
Responsiveness is managed by your CSS and in some rare cases with JS. It's possible to use Bootstrap to, but better to build it from .less sources excluding some parts (like normalize, scaffolding, type) which break SharePoint styles dramatically.
Such model is easily deployable to different environments with gulp automation. You could check gulp-spsave or a boilerplate generator - sppp which creates a project capable publishing assests to sharepoint without manual configuration of automation tasks. Some Node.js background is needed, though. But it worth it. Cause you receive tons of automation capabilities, including live reload on dev environments.
Also, I would recommend SPMeta2 for artifacts code base provisioning as an advanced alternative for PnP provisioning, yet, PnP provisioning is better than declarative XML/CAML based no code features provisioning.
All of the mentioned above is easily integrated to the DevOps to repeatable deployment to the different environments.
Dealing with CEWP with script source is a step next to SharePoint framework. Most of the development workflow is very close to what you can face in SPFx and when SPFx is ready to you you'll be mostly ready to it.