Skip to content

mohamnag/broccoli-splitter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

broccoli-splitter

A broccoli plugin for splitting text into new files.

Sample usage

Following configuration reads parts of index.html from inside and ember-cli app directory and creates two PHP files out if it:

var splitHtmlToPHP = brocSplitter(
    [
        'dist'
    ],
    [
        {
            'input': 'index.html'
            'from': '<!-- split: Header begin -->',
            'to': '<!-- split: Header end -->',
            'output': 'header.php'
        },
        {
            'input': 'index.html'
            'from': '<!-- split: Body begin -->',
            'to': '<!-- split: Body end -->',
            'output': 'body.php'
        }
    ]
);

when index.html looks like following:

<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="description" content="">
    <meta name="viewport" content="width=device-width, initial-scale=1">

    <!-- split: Header begin -->

    {{content-for 'head'}}

    <link rel="stylesheet" href="assets/vendor.css">
    <link rel="stylesheet" href="assets/main.css">

    {{content-for 'head-footer'}}

    <!-- split: Header end -->
</head>
<body>
    <!-- split: Body begin -->

    {{content-for 'body'}}

    <script src="assets/vendor.js"></script>
    <script src="assets/main.js"></script>

    {{content-for 'body-footer'}}

    <!-- split: Body end -->
</body>
</html>

About

A broccoli plugin for splitting text into new files.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published