Zontroy Single File

Zontroy has 3 file types to generate code.

zsif

Zontroy Single File is used to generate lines of code inside a single file. It uses .zsif extension.

File Naming Format

[file_name].[file_extension].zsif

File Naming Example

MyCodeFile.java.zsif

Code Example

A simple usage example of zsif file in React.js.

// PrivateRoutes.tsx.zsif
import {Suspense} from 'react'
import {Route} from 'react-router-dom'

zg-for(((zg-item:::[[[zg-entities]]]))){{{
const [[[zg-item...zg-name]]]Page = lazy(() => import('../modules/zg-lower(((zg-item...zg-name)))/zg-singularize(((zg-item...zg-name)))Page'))   
}}}

zg-for(((zg-item:::[[[zg-entities]]]))){{{
  <Route
    path='crafted/zg-pluralize(((zg-lower(((zg-item...zg-name))))))/zg-lower(((zg-item...zg-name)))/*'
    element={
      <SuspensedView>
        <[[[zg-item...zg-name]]]Page />
      </SuspensedView>
    }
  />
}}}

Output Example

// PrivateRoutes.tsx.zsif
import {Suspense} from 'react'
import {Route} from 'react-router-dom'
    

const cityPage = lazy(() => import('../modules/city/cityPage'))   

const countryPage = lazy(() => import('../modules/country/countryPage'))   

const customerPage = lazy(() => import('../modules/customer/customerPage'))   



  <Route
    path='crafted/cities/city/*'
    element={
      <SuspensedView>
        <cityPage />
      </SuspensedView>
    }
  />

  <Route
    path='crafted/countries/country/*'
    element={
      <SuspensedView>
        <countryPage />
      </SuspensedView>
    }
  />

  <Route
    path='crafted/customers/customer/*'
    element={
      <SuspensedView>
        <customerPage />
      </SuspensedView>
    }
  />

Generate in Zontroy IDE

Create an Empty Zontroy Project using menu File -> New Project -> Create (Empty Zontroy Project).

Add a zsif file into the project

Name the file as PrivateRoutes.tsx.zsif or anything you want and click Add File

Open newly created zsif file, write the code provided above as an example and save it.

Click blue generate button and see the output

Good to know: In daily programming, routing, object mapping, dependency injection and context management are sample concepts which for using a single code file.

Last updated