This repository serves as a complete example of a form with different types of fields, including required validations and custom text fields.
The components are meticulously structured, following the BEM
(Block Element Modifier) and ITCSS
(Inverted Triangle CSS) architecture, ensuring easy maintenance and scalability as the project grows.
Integrating client-side JS
validations enhances the user experience by providing real-time feedback as they interact with form fields.
Whether you want to improve your form building skills or are looking for organizational inspiration, these components provide an excellent starting point. They provide a valuable reference for other web development projects, provide a solid CSS
class structure, powerful client-side JS
validations, and unique custom elements.
The best part is that you can easily customize these components to fit your specific project requirements, making them adaptable and valuable for various web development endeavors.
This project is developed inside of src
folder, using in HTML
, CSS
(with the SASS
preprocessor) and JS
(with the Jquery
library).
To streamline the build process, the project utilizes the Gulp
task runner, which compiles and optimizes the files, placing them in the dist
folder.
Once everything is ready, the project is published using an NPM
script in the gh-page
branch on GitHub.
Here are the main technologies and tools used in this project:
JQuery 3.4.1
jQuery is a fast, small, and feature-rich JavaScript
library. It makes things like HTML
document traversal and manipulation, event handling, animation, and Ajax
much simpler with an easy-to-use API that works across a multitude of browsers.
jQuery Validation 1.19.1
This jQuery plugin makes simple clientside form validation easy, whilst still offering plenty of customization options. It makes a good choice if you’re building something new from scratch, but also when you’re trying to integrate something into an existing application with lots of existing markup. The plugin comes bundled with a useful set of validation methods, including URL and email validation, while providing an API to write your own methods. All bundled methods come with default error messages in english and translations into 37 other languages.
Some more methods are provided as add-ons, and are currently included in additional-methods.min.js
in the download package. You can find the source code for all additional methods in the GitHub repository.
CKEditor 4
Modern JavaScript
rich text editor with a modular architecture. Its clean UI and features provide the perfect WYSIWYG UX ❤️ for creating semantic content. It is full of features like pasting from Word, Excel and Google Docs. It's excellent table support with column resizing, row and column selection. You can include multimedia embeds as insert images, videos, tweets, Instagram posts widgets, code snippets, mathematical formulas and more. It has spreadsheets to create data grids within the editor. It uses autocomplete, @mentions, emoji 😊, styling and formatting plugins (copy formatting feature). It is designed with inline and iframe UI, autogrow, maximize mode for distraction-free typing with the read-only mode ...and more!
Here you can see the README.md file of this project and the samples folder.
As mentioned above, this project makes use of the Gulp
task runner. The gulpfile.js file contains several Gulp
tasks designed to:
- Compile and compress
SASS
andJS
files. - Copy and paste
HTML
files andICOMOON
icon fonts. - Create a server and enable live reloading using Browsersync + Gulp.js.
So project development takes place in the src
and the final optimized content is generated in the dist
folder for publishing. This setup ensures an efficient and organized workflow for web development.
npm install
src
folder is finished, you can publish the project with the contents of the dist
folder to Github Pages (gh-pages
branch).
npm run deploy
The default gulp task handles various tasks:
-
Creates the
dist
folder if it does not exist. -
Build
html
,css
,js
and font icons oficomoon
in thedist
folder. -
Watch for changes inside the
src
folder to rebuild the files. -
Sets a server and reloads it automatically when changes are made to the
dist
folder.
gulp
This command is able to:
-
Create a static server with the
browserSync
package. -
Serve the files in the
dist
folder. -
Open the default
index.html
file in any of these browsers:Chrome
andFirefox
.
gulp serve
This command is a powerful tool that performs the following tasks:
- Create and launch a server.
-
Observe the changes in the
html
,sass
,icomoon
andjs
files located inside thesrc
folder. -
When a change occurs, runs the necessary tasks to re-generate the files inside the
dist
folder. -
Consequently, it reloads the server automatically, if there are any changes in the files inside the
dist
folder.
This ensures a smooth development experience, as you can make changes to your source files and see updates in real time without manually refreshing the page.
gulp watch
This command is able to:
-
Creates the
dist
folder if it does not exist. -
Build the
html
,css
,js
andicomoon
ondist
folder.
gulp build
This command is able to:
-
Creates the
dist
folder if it does not exist. -
Copies the
html
files from thesrc
folder to thedist
folder.
gulp html
This command is able to:
-
Creates the
dist
folder if it does not exist. -
Performs a series of processes:
-
Compiles the
styles.sass
file, including its imported partials located atsrc/sass/
. -
Adds prefixes to
CSS
. properties for better browser compatibility. -
Compresses the
CSS
. file to reduce its size for optimized performance. -
Creates and adds a
mapping
for the debugger styles in the browser inspector for easier debugging. -
Applies a Gulp Plugin,
Line Ending Corrector
, to ensure consistent line endings in yourCSS
. files.
-
Compiles the
-
Export the
styles.min.css
file todist/css/
folder.
gulp css
This command is able to:
-
Creates the
dist
folder if it does not exist. -
Copies files of
JS
libraries fromsrc/js/libs
and pastes them intodist/js/libs
folder. -
Performs a series of processes:
-
Compile partials
JS
files partials located atsrc/js/
. -
Use
Babel
, a JavaScript compiler, to ensure backward compatibility and compatibility with various browsers. - Minifies the concatenated file, reducing its size for optimized performance.
-
Applies a Gulp Plugin,
Line Ending Corrector
, to ensure consistent line endings in yourJS
. files.
-
Compile partials
-
Export the
scripts.min.js
file todist/js
folder.
gulp js
This project uses icons from icomoon.io, an online tool app that has 2 buttons to generate SVG & More
and generate Font
.
The src/icomoon/
folder contains a mix of both downloaded folders.
This command is able to:
-
Creates the
dist
folder if it does not exist. -
Gets
style.css
file fromsrc/icomoon/
folder, generates a new compressed file, renames itfonts.min.css
and export the file todist/icomoon
. -
Copy directory
src/icomoon/fonts
, containing the fonts (EOT, SVG, TTF, WOFF), and paste the files intodist/icomoon/fonts
gulp icon
There is still room for improvement in validation, such as the implementation of showing/hiding fields dynamically as the user fills/hides them... and many other potential areas.